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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
1 0 0 0

Not receiving the "_on_message" message from Refinitiv WebSocket

Hello,


While integrating and testing the connection through the new authentication method (v1 to v2), I came across a bottleneck unfortunately.


The problem is as follows:

The REST post request (v2) works and I can get hold of the token, but then I can't seem to make the socket connection work properly. The problem is that once I open a connection (so before self._send_login_request(auth_token) ), I do not receive an _on_open message so that the rest of the code gets executed (sending the token, requesting prices etc.). Instead, the thread gets stuck waiting for messages (I believe).


The last log I'm getting is: Session1: Connecting WebSocket to wss://us-east-1-aws-3-sm.optimized-pricing-api.refinitiv.net:443/WebSocket...

After this the thread remains open for a couple of seconds and then is killed.

However, when following the same steps but this time through PostMan, I am able to open a connection, I then receive the Stream: open message, I am able to send the login_request, my login attempt is successful and then finally I am able to send a market_price_request to which I get the desired socket response. For some reason, the python process (which I've taken from Refinitiv's documentation at https://github.com/Refinitiv/websocket-api/blob/master/Applications/Examples/RDP/python/market_price_rdpgw_client_cred_auth.py) is not able to accomplish this.


Many thanks,

Tudor

python#technologywebsocketsrefinitiv-realtime-optimised
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.

1 Answer

· Write an Answer
Upvote
Accepted
23.6k 61 15 21

Hello @fg01,

Are you running the client-credentials Python sample as-is, without any modification? If yes, then probably the secure websocket connection is blocked on your network. Please try the sample from machine which is directly connected to the internet without any firewall etc.

Postman might be using the system proxy information - different Python modules have to be specifically configured for this proxy information in their own specific way.

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.