The server close connection for the client after a while and client disconnect automatically after try to send a message :
newmsg = await websocket.recv()
the problem is the server is sending pings to the client and try to get a response which is the newmsg, when the msg is not sent back then the server close the connection after 20 sec which is the default value, the solution is to desactivate the ping from the server and the client if you want : server.py:
start_server = websockets.serve(receive_name, "localhost", 8765,ping_interval=None)
client.py :
async with websockets.connect(uri, ping_interval=None) as websocket:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With