#!/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()
