Error during WebSocket handshake

Description 

Call fails to connect, with following error being printed in Console log:

WebSocket connection to 'wss://<CafeX_GW_address>:8443/gateway/websocketcall?appkey=FWGW-<random app key>' failed: Error during WebSocket handshake: <error response>

It is possible that above error message is repeated in the console log as SDK try to reconnect with a configured interval.

Resolution

Resolution will depend upon underlying cause suggested by the " <error response>" in the logged error message.

Below is a list of possible error responses and possible resolutions:

  • Error in connection establishment: net::ERR_CONNECTION_REFUSED

Above error message is often noticed when CafeX FAS server host address is accessible but service is not running. Check following:

1. FAS service is running.  You may refer to article "How do I know  if FAS is running"

2. Port mentioned in connection URL is correct, FAS default secure port is 8443, and un-secure port is 8080.

  • Error during WebSocket handshake: Unexpected response code: 503

Above error message is often noticed when application server component of FAS is not running. Check following:

1. FAS service is up and running. You may refer to article "How do I know if FAS is running"

2. It is possible that FAS service was being re-started when error occurred, after checking FAS service is running, reattempt the call.

  • Error during WebSocket handshake: Unexpected response code: 403

Above error message suggest that although CafeX server is reachable but it is unable to allow websocket connection, due to following possible causes:

1. Session token provided by web application is not valid or expired. You may refer to FCSDK/Live Assist Developer guide to understand how to create and use Session Token.

2. If a session token verification process failed for application specific scenario. Collect server side logs for further analysis as suggested here and share with Customer Support.

  • Error during WebSocket handshake: 'Sec-WebSocket-Accept' header is missing

Above error message suggest that Reverse Proxy server on the path is not configured to support websocket.

Check Reverse Proxy config to ensure websocket URL for Gateway and Assist Topic are defined as per Product documentation. 

  • Error during WebSocket handshake: Unexpected response code: 302

Above error message suggest that Websocket upgrade request reached CafeX server but was not processed as a websocket connection request. Instead it was processed as HTTP GET request caused by following:

1. A Firewall or a proxy server has removed http headers defining request as websocket upgrade request, below are examples of such headers:

Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==
Sec-WebSocket-Version: 13

2. A Reverse Proxy servicing HTTP traffic to/from CafeX server is re-using TCP connection. Earlier version of FAS (<= 2.5.2) do not support TCP connection reuse for Websocket upgrade. Disable TCP connection reuse setting on Reverse Proxy else contact support for possible FAS upgrade.

  • Error during WebSocket handshake: Unexpected response code: 500

Above Error suggest an error occurred while websocket upgrade request was being processed. It is usually caused by SSL layer issue. Check that reverse proxy is either configure to do SSL-offloading or configured with necessary module to create SSL connection with FAS.

  • Error during WebSocket handshake: net::ERR_CONNECTION_RESET

Issue is caused when Firewall is blocking websocket connection, or not configured to handle websocket connection.

  • Error in connection establishment: net::ERR_NAME_NOT_RESOLVED

Issue is caused by loss of DNS server. This issue is seen when Client is using unstable network connection. If Site is available on internet, It is also worth configuring Client device / Browser to use an external DNS server such as 8.8.8.8 to rule out issue with local DNS server.

  • Error in connection establishment: net::ERR_NETWORK_CHANGED

This issue is caused by loss of network connection while call is being setup. It could be walking out of wi-fi range or switching between network during the call. It can also be caused by momentary loss of network during the call. Issue may correct itself once network stability is achieved. 

 

Have more questions? Submit a request

Comments

Powered by Zendesk