TsgcWebSocketClient | WebSocket Redirections
When the client connects to a WebSocket server, the server can return
an HTTP Response Code 30x. If the response code is 301, it means that
the location has been moved permanently, and the new URL is provided in
the Location HTTP Header.
The WebSocket client handles redirections automatically, so if it detects
that the server response contains a redirection, it will disconnect the current
connection and attempt to connect to the 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 is a redirection and reads the Location
- First disconnects the current connection.
- Updates the URL property with the value
of the Location Header (ws://80.50.1.2:3000)
- Connects to the new server.