summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorAlberto Galera <galerajimenez@gmail.com>2017-07-07 11:38:51 +0200
committerGitHub <noreply@github.com>2017-07-07 11:38:51 +0200
commitaee2231b1d5ac53107ca90cf948bcca45074ce80 (patch)
treeab3c25b5b58be9e8e9c070e6dc1a761f1c3d6580 /examples
parent8c90d16d0e9e59a524401d7324a8f7cbbae6888d (diff)
downloadwebsocket-client-aee2231b1d5ac53107ca90cf948bcca45074ce80.tar.gz
use threading
Diffstat (limited to 'examples')
-rw-r--r--examples/echoapp_client.py8
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)