Problem on websocket_MTC

hello dear,
I encountered a problem. Friends can help,
The problem is: The socket web server address does not connect to the directory
example: “wss://example.com/echo/websocket”

error is : Could not negotiate connection: Could not handle the response code 301 returned by the server

please help me

301 is a redirect. You’ll need to look at the location header and try again with the new url.

I with url wss and ws I tested.
url example wss://example.com/echo/websocket

Example: iqoption.com
Please test

If I recall correctly, with the error 301, you get code that holds the new URL. You have to take it from there (look in the debugger for example)

If you test that URL in a browser you will see that it redirects to a different URL

I tested with different programs, but it did not work with the upper class

This is a very important guide for me

Attach File

Please You can help the attached project file

please help me, The project has stopped due to this problem!

That’s because the other programs detect the redirect and make a new request to the new url. That’s what you will need to do. Have you tried what people have suggested?

I tried a lot but it can’t be done, you can test

I tried a lot but it can’t be done, you can test

A friend cannot test the project

When I ran a test using the URL you provided, I get a 301 redirect with no forwarding URL. Have you checked the documentation for the API you are attempting to use? I couldn’t find any.

See, you can try any program that connects with the web socket, it connects without any delay, but it does not connect with the web socket class Websocket_MTC You can also try with ws/wss

thanks ,My friends problem was solved

What was the problem and what did you do to solve it? Others may have the same issue in the future.

connection type change and security and change update commit websocket_MTC

1 Like

Excellent. Thanks for reporting back!

Forum for Xojo Programming Language and IDE. Copyright © 2021 Xojo, Inc.