|
@@ -0,0 +1,22 @@
|
|
|
+import asyncio
|
|
|
+import websockets
|
|
|
+import sys
|
|
|
+
|
|
|
+async def hello(message):
|
|
|
+ uri = "ws://193.2.68.227:8765"
|
|
|
+ async with websockets.connect(uri) as websocket:
|
|
|
+ print('Sending {}'.format(message))
|
|
|
+
|
|
|
+ await websocket.send(message)
|
|
|
+ print(">>> {}".format(message))
|
|
|
+ #receive nothing
|
|
|
+ #greeting = await websocket.recv()
|
|
|
+ #print(f"<<< {greeting}")
|
|
|
+
|
|
|
+if __name__ == "__main__":
|
|
|
+ message=sys.argv[1]
|
|
|
+ loop = asyncio.get_event_loop()
|
|
|
+ # Blocking call which returns when the hello_world() coroutine is done
|
|
|
+ loop.run_until_complete(hello(message))
|
|
|
+ loop.close()
|
|
|
+
|