TsgcWebSocketClient | WebSocket Redirections
When the client connects to a WebSocket server, the server can return
an HTTP Response Code 30x. If the Response code it's a 301, means that
the location has been moved permanently, and the new url is informed in
the Location HTTP Header.
The WebSocket client, handle redirections automatically, so if detects
the Server Response contains a redirection, it will disconnect the actual
connection and try to connect with then new Location URL.
Example
- Client first tries to connect to url ws://127.0.0.1:5000
- Server returns a Response Code of 301
and contains a Header Location with the value ws://80.50.1.2:3000
- Client reads the Response from server,
detects that it's a redirection and reads the Location
- First Disconnects the actual connection.
- Update the URL property with the value
of Location Header (ws://80.50.1.2:3000)
- Connects to the new server.