dpallot / simple-websocket-server

A python based websocket server that is simple and easy to use.
951 stars 321 forks source link

SSL Chat Server Example.. fail.. #47

Closed vusdo closed 7 years ago

vusdo commented 7 years ago

echo server pass.. chat server fail..

how do I Broadcast to clients from chat server?

This is the log that server dies when connected in the browser.

Thank you for your help

nvidia@tegra-ubuntu:~/voice/websocket/SimpleWebSocketServer$ python SimpleExampleServer.py --example chat --ssl 1 --cert ./cert.pem Traceback (most recent call last): File "SimpleExampleServer.py", line 71, in server.serveforever() File "/home/nvidia/voice/websocket/SimpleWebSocketServer/SimpleWebSocketServer.py", line 688, in serveforever super(SimpleSSLWebSocketServer, self).serveforever() File "/home/nvidia/voice/websocket/SimpleWebSocketServer/SimpleWebSocketServer.py", line 646, in serveforever client.handleClose() File "SimpleExampleServer.py", line 38, in handleClose clients.remove(self) ValueError: list.remove(x): x not in list

dpallot commented 7 years ago

Hi Vusdo, The chat example does the broadcast for you i.e.sendMessage to each client that is connected on disconnect, connect and message.

In regards to your exception, I think the only way to get multiple handleClose callbacks is on shutdown. I will rework how close interacts with the main loop.

dpallot commented 7 years ago

Handled in #52