We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ace2765 commit fd94369Copy full SHA for fd94369
1 file changed
ws4py/client/threadedclient.py
@@ -48,6 +48,13 @@ def daemon(self, flag):
48
"""
49
self._th.daemon = flag
50
51
+ def run_forever(self):
52
+ """
53
+ Simply blocks the thread until the
54
+ websocket has terminated.
55
56
+ self._th.join()
57
+
58
def handshake_ok(self):
59
60
Called when the upgrade handshake has completed
@@ -56,7 +63,6 @@ def handshake_ok(self):
63
Starts the client's thread.
64
65
self._th.start()
- self._th.join(timeout=1.0)
66
61
67
if __name__ == '__main__':
62
68
from ws4py.client.threadedclient import WebSocketClient
@@ -77,5 +83,6 @@ def received_message(self, m):
77
83
try:
78
84
ws = EchoClient('ws://localhost:9000/ws', protocols=['http-only', 'chat'])
79
85
ws.connect()
86
+ ws.run_forever()
80
87
except KeyboardInterrupt:
81
88
ws.close()
0 commit comments