diff options
| author | Alberto Galera <galerajimenez@gmail.com> | 2017-07-07 11:38:51 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-07-07 11:38:51 +0200 |
| commit | aee2231b1d5ac53107ca90cf948bcca45074ce80 (patch) | |
| tree | ab3c25b5b58be9e8e9c070e6dc1a761f1c3d6580 /examples | |
| parent | 8c90d16d0e9e59a524401d7324a8f7cbbae6888d (diff) | |
| download | websocket-client-aee2231b1d5ac53107ca90cf948bcca45074ce80.tar.gz | |
use threading
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/echoapp_client.py | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/examples/echoapp_client.py b/examples/echoapp_client.py index c15b35f..8c01a94 100644 --- a/examples/echoapp_client.py +++ b/examples/echoapp_client.py @@ -1,8 +1,5 @@ import websocket -try: - import thread -except ImportError: # TODO use Threading instead of _thread in python3 - import _thread as thread +from threading import Thread import time import sys @@ -32,7 +29,8 @@ def on_open(ws): ws.close() print("Thread terminating...") - thread.start_new_thread(run, ()) + Thread(target=run).start() + if __name__ == "__main__": websocket.enableTrace(True) |
