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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
3 3 4 7

Handshake status 500 handshakefailed when running the markety_price.py example code.

Hi,

When running the Python code (I use Python) market_price.py from the WebSocket API Sample Applications (link) Iget the following:

Connecting to WebSocket ws://hostname:15000/WebSocket ...
Handshake status 500 handshakefailed
WebSocket Closed

I do have the market data server setup (ADS) within my environment that supports the WebSocket API and I am able to login via the interactive guide on the developer's portal.

Could anyone explain to me how this must be done correctly?

I fail to see what I should do other than setting the default global variables to my values and then run the code.

Thanks in advance,

I hope my question is sufficiently clear,

Best regards

pythontreprdp-apiwebsocketsrrto
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.

<AHS only>

Waiting for the client's response, extend triage.

Hello @mehdi.el.hamzaoui,

Are you able to confirm you are connecting and seeing market price updating data via interactive documentation in your browser?

Are you connecting successfully to the same ADS hostname that you attempt to connect via python example, or to an IP address?

Any info in ADS log?

@mehdi.el.hamzaoui

Hi,

Thank you for your participation in the forum.

Are any of the replies below satisfactory in resolving your query?

If yes please click the 'Accept' text next to the most appropriate reply. Otherwise, you can share your finding and then click the ‘Accept’ to accept your answer as a correct answer. This will guide all community members who have a similar question.

Otherwise please post again offering further insight into your question.

Thanks,

AHS

Please be informed that a reply has been verified as correct in answering the question, and has been marked as such.

Thanks,

AHS

Upvotes
Accepted
17.1k 80 39 63

Hi @mehdi.el.hamzaoui,

If all other examples failed and it works in your browser only, there must be something different in the route of your access when you are in your browser. Confirm you are able to successfully send requests and receive responses in your browser just to make sure. Also, check your logs in the ADS for additional details related to your different tests. Confirm both the browser connection and application connects to compare.

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
17.1k 80 39 63

Hi @mehdi.el.hamzaoui,

Can you confirm which version of Python you are using? There are some specific instructions within the README file that you will need to pay attention to. For example:

NOTE: The posting example must be run with Python3.0 or greater. The other 
examples may be run with Python2.7 or greater.<br>

And

Run (in order):
   pip install requests
   pip install websocket-client
   (Only for Python versions less than 3.3) pip install ipaddress

Also, you may be going through a proxy and within your browser, the setup may be different than running from a command window. You may need to confirm your network access.

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.

Hi @nick.zincone.1 and thank you for your quick reply,

I am using Python 3.6.5 and have indeed followed the instructions within the README file installing the above mentioned packages.

update: I tried running it in PyCharm but to no avail:

Connecting to WebSocket ws://hostname:port/WebSocket ...<br>Handshake status 500 handshakefailed<br>WebSocket Closed

Hi @mehdi.el.hamzaoui,

I didn't find much information on a WebSocket error status 500 other than issues related to network routes, proxy setting, etc. Is it possible for you to try one of the other examples? This may provide a clue as to whether the issue is related to your network setup and the route to ADS.

In addition, find out if the ADS logs are showing any additional related to your connection.

Hi @nick.zincone.1 ,

I have tried the other examples as well as disabled the firewall temporarily, but it did not help.

Thanks anyway

Upvotes
24.6k 54 17 14

Hello @mehdi.el.hamzaoui

Did web browser interactive guide and Python application connect to the same ADS host and WebSocket port?

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.

Yes, it did. However the issue has been solved. It was actually a problem with my machine.

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.