question

Upvote
Accepted
18 2 2 3

WebSocket error occurred for web socket client. Connection is already closed.

Hi,
We use refinitiv-dataplatform==1.0.0a6 and Python 3.8.6 (Debian GNU/Linux 10 (buster))

It works fine but after a few hours it returns:

[2020-10-26 02:15:04,471] - [session.platform] - [ERROR] - [stream_connection] - [_ws_error] - WebSocket error occurred for web socket client 1 (login id 2483) : Connection is already closed.
[2020-10-26 02:16:05,363] - [session.platform] - [ERROR] - [stream_connection] - [_ws_error] - WebSocket error occurred for web socket client 1 (login id 2484) : Connection is already closed.

What could be the issue?


Python code:

def streaming_prices():
    streaming_prices = rdp.StreamingPrices(
        universe=list_of_rics,
        on_update=lambda streaming_price, instrument_name, fields:
        display_updated_fields(streaming_price, instrument_name, fields)
    )
    streaming_prices.open()
    while True:
        try:
            asyncio.get_event_loop().run_until_complete(asyncio.sleep(1))
        except (KeyboardInterrupt, SystemExit):
            rdp.close_session()
            break
pythonrdp-apirefinitiv-data-platformwebsocketsrefinitiv-data-platform-libraries
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
Upvotes
Accepted
24.8k 64 15 21

Hi @Alena.Melnikova,

There is an updated version of RDP library refinitiv-dataplatform 1.0.0a7. Can you please try with this.

I am trying to ascertain if it is the Refresh token renewal which fails or your network components - proxy/firewall drops the connection. For latter, are you able to perform this test from a different network like home or office. Keeping track of how long it stays connected will also help.

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 @Gurpreet,

Thanks for the response. Interesting but I didn't see this error for a few days already. Don't know what was a problem.

I'll try with 1.0.0a7 during this week, thanks for the update!
Unfortunately, I can't test on different networks. For long runs, I can only run on ec2. I'll let you know if see a similar issue again.

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.