From 00bd0765d7fb7e8f3317f02dadb8aeaceb9f11b4 Mon Sep 17 00:00:00 2001 From: chris2286266 Date: Sat, 14 Oct 2017 09:57:33 +0200 Subject: [PATCH] added WebSocket client --- .../WebSockets/websocket_simple_client.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 Networking/WebSockets/websocket_simple_client.py diff --git a/Networking/WebSockets/websocket_simple_client.py b/Networking/WebSockets/websocket_simple_client.py new file mode 100644 index 0000000..d9520f2 --- /dev/null +++ b/Networking/WebSockets/websocket_simple_client.py @@ -0,0 +1,18 @@ +# +# Very simple WebSocket client +# 14.10.2017 +# chris2286266 +# + +from websocket import create_connection + +ws = create_connection("ws://echo.websocket.org/") +print("Sending 'Hello, World'...") +ws.send("Hello, World") +print("Sent") + +print("Receiving...") +result = ws.recv() +print("Received '%s'" % result) + +ws.close() \ No newline at end of file