New posts are disabled while we improve the user experience.

You can browse the site, or for urgent issues, raise a query at MyAccount.

question

Upvotes
Accepted
1 0 0 0

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

#technologywebsocketsjava
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
Accepted
28k 68 18 14

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


websocket.png (146.5 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
87.8k 294 53 79

@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?


1716277447752.png (80.7 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.