WebSocket API cannot connect

Hi Team,


Using Java websocket to connect to WebSocket API, unable to connect, but the network is normal,URL is ws://ip:port/WebSocket


Thanks

Best Answer

  • wasin.w
    wasin.w admin
    Answer ✓

    Hello @dreamjie2020

    I am assuming that you are connecting to the local deployed RTDS. What is the version of ADS/RTDS server that you are using? The WebSocket connection needs at least ADS version 3.2.1 and above.

    Additionally, did you enable the WebSocket connection in the ADS configuration yet?

    websocket.png

Answers

  • @dreamjie2020

    Thank you for reaching out to us.

    You can try the WebSocket Java Examples on GitHub.

    Please see the instructions on that page regarding how to run the examples.

    Moreover, you can test the WebSocket connection by using the curl command.

    curl --no-buffer --header "Upgrade: websocket"  --header "Connection: Upgrade"   --header "Sec-WebSocket-Key: s595Nk+O22u2vOpCFHFAqQ==" --header "Sec-WebSocket-Version: 13" --header "Sec-WebSocket-Protocol: tr_json2" --header "Accept:"  --header "User-Agent:" --header "Host:" -v http://ip:port/WebSocket

    For example:

    1716277447752.png

    Did you receive any errors when running the application?