import asyncio import websockets import sys async def hello(message): args=message.split(':') #server="vangogh.fmf.uni-lj.si" server=args[0]; message=':'.join(args[1:]) uri = "ws://{}:8765".format(server) origin="merlin" async with websockets.connect(uri,origin=origin) 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()