WebSocket was closed: An exception has occurred while connecting

Unable to connect.

Getting the following:


Connecting to WebSocket ws://192.168.XXX.XXX:15000/WebSocket ...Received Log Event (Level: Fatal): WebSocketSharp.WebSocketException: Not a WebSocket handshake response.
at WebSocketSharp.WebSocket.doHandshake()
at WebSocketSharp.WebSocket.connect()

WebSocket was closed: An exception has occurred while connecting.|WebSocketSharp.CloseEventArgs

Connecting to WebSocket ws://192.168.XXX.XXX:15000/WebSocket ...Received Log Event (Level: Fatal): WebSocketSharp.WebSocketException: Not a WebSocket handshake response.
at WebSocketSharp.WebSocket.doHandshake()
at WebSocketSharp.WebSocket.connect()

WebSocket was closed: An exception has occurred while connecting.|WebSocketSharp.CloseEventArgs

Best Answer

  • Jirapongse
    Jirapongse ✭✭✭✭✭
    Answer ✓

    @Cherilyn.Lazaga

    I have tested with the C# example in GitHub. It can connect to ADS with the WebSocket connection and retrieve the data properly.

    Connecting to WebSocket ws://localhost:15000/WebSocket ...WebSocket successfully connected!


    SENT:
    {
      "ID": 1,
      "Domain": "Login",
      "Key": {
        "Name": "<user>",
        "Elements": {
          "ApplicationId": "256",
          "Position": "192.168.0.184"
        }
      }
    }

    However, if I changed the port number from 15000 to another port that is not for a WebSocket connection, such as 14002, I got the following error.

    Connecting to WebSocket ws://localhost:14002/WebSocket ...Received Log Event (Level: Fatal): Not a WebSocket handshake response.


    WebSocket was closed: An error has occurred while connecting.

    You may need to verify the WebSocket connection on ADS works properly. You can use the rmdstestclient or testclient tool available in the ADS package to verify the WebSocket connection. For more information, please refer to the How to test WebSocket connection with rmdstestclient tool article.