For a deeper look into our Elektron API, look into:

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

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
25.7k 58 17 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
81.2k 266 53 76

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