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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
21 7 5 11

WebSocket API "Connection is already closed"

Hi,

I am testing yours WebSocket API from the provided example market_price.py downloaded from this site.

I get following response "Connection already closed" and would appreciate help on how to solve it.

/market_price.py
Python version 3.6.2 (v3.6.2:5fd33b5, Jul 8 2017, 04:57:36) [MSC v.1900 64 bit (AMD64)]
Websocket_client version 0.53.0

Connecting to WebSocket ws://ap-server1t:14002/WebSocket ...
Connection is already closed.
WebSocket Closed

Kind regards,

Johan

treprdp-apiwebsocketsrrtoconnection
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
114 3 6 7

Hi Johan,

Port 14002/tcp usually binds the RSSL adapter of the ADS, when WS api listens onto a different port (15000/tcp when using default), are you sure you are addressing the correct port ?

Regards,

Julien

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.

Upvote
25.3k 87 12 25

Hi @johan.lundquist

Can you confirm that 14002 is the correct port for the server you are connecting to?

The default port for Websocket is 15000 and the 14002 port is actually the default port for RSSL type connections.

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
21 7 5 11

Thank you Julien and Umer, you are absolutely right my mistake it works as expected now.

Kind regards,

Johan

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.