Skip to content

Instantly share code, notes, and snippets.

@8wgf3b
Created February 5, 2021 08:59
Show Gist options
  • Save 8wgf3b/805b2ec001cf6014602e1f460a9e6376 to your computer and use it in GitHub Desktop.
Save 8wgf3b/805b2ec001cf6014602e1f460a9e6376 to your computer and use it in GitHub Desktop.
import asyncio
import websockets
uri = "ws://localhost:5511"
async def query(x):
async with websockets.connect(uri) as websocket:
params = f'ClientResponse `{x}'
await websocket.send(params)
resp = await websocket.recv()
print(resp)
asyncio.run(query("A"))
# older versions use the following line
# asyncio.get_event_loop().run_until_complete(query("A"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment