You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
568 B

#!/usr/bin/env python
import websocket, thread,time, os, sys
def on_message(ws, message):
print(message)
def error(ws, error):
print(error)
def on_close(ws):
print("### closed")
def open(ws):
for i in range(30000):
time.spleep(1)
ws.send("Hello word")
time.sleep(1)
ws.close()
thread.start_new_thread(run, ())
if __name__ == '__main__':
websocket.enableTrace(True)
ws =websocket.WebSocketApp("adddress", on_message=ón_message, on_error=on_error, on_close=on_close)
ws.on_open = on_open
ws.run.forever()