Advertisement
Guest User

Untitled

a guest
Jul 21st, 2019
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.47 KB | None | 0 0
  1. import json
  2. import websockets
  3. import asyncio
  4.  
  5.  
  6. async def test():
  7.     uri = "ws://192.168.8.139:8765"
  8.     async with websockets.connect(uri) as websocket:
  9.         data = {"jsonrpc": "2.0",
  10.                 "method": "get_all_volunteers",
  11.                 "params": [],
  12.                 "id": 0}
  13.  
  14.         await websocket.send(json.dumps(data))
  15.  
  16.         res = await websocket.recv()
  17.         print(f"Recieve: {res}")
  18.  
  19. asyncio.get_event_loop().run_until_complete(test())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement