python-websockets / websockets

Library for building WebSocket servers and clients in Python

Home Page:https://websockets.readthedocs.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

websocket connection is closing after some time unexpectedly

fti-ravhad opened this issue · comments

I am using webrtc to live stream media , after some time ice-candidates sending and receiving the connection is closed with below exceptions.
Screenshot from 2024-01-18 11-17-17
The connection works for keepalive_timeout time only, after that it closes . What are the reasons behind this exceptions

Python version : 3.10.12
websockets version : 12

I have the exact same issue as this.

What is the solution?

https://websockets.readthedocs.io/en/stable/project/contributing.html#cryptocurrency-users

im not crypto user nor crypto developer 😭 I use ws to communicate with robots

(Also -- https://websockets.readthedocs.io/en/stable/faq/client.html#how-do-i-force-the-ip-address-that-the-client-connects-to)

Thanks! This is pretty much what I have. I called it the temporary bandaid but turn out this is the official solution. Deeply thank you for your time!

Oops, sorry — that answer was meant for another issue, namely #1447 — my mistake 🙏

That's ok!

You can close this since your doc has the answer already. This answered the main of this issue as well

The stack trace shows that the other side in closing the websocket connection normally. That's what received 1000 (OK); then sent 1000 (OK) means. 1000 is the normal close code.

I'm glad you could figure it out with the FAQ anyway!

just add asyncio.TimeoutError .. instead of TimeoutError . This worked for me..