-
Notifications
You must be signed in to change notification settings - Fork 285
Open
Description
from ws4py.client.threadedclient import WebSocketClient
from ws4py.exc import HandshakeError
class DummyClient(WebSocketClient):
def opened(self):
self.send(input('请输入你想说的话:'))
def closed(self, code, reason=None):
#print("Closed down", code, reason)
print("Closed down")
def received_message(self, m):
print (m)
if name == 'main':
try:
ws = DummyClient('ws://'+input('请输入ws地址连接:'), protocols=['chat'])
ws.connect()
ws.run_forever()
except KeyboardInterrupt:
ws.close()
Metadata
Metadata
Assignees
Labels
No labels