mirror of
https://gitlab.com/theadib/JSonRPCPlugin.git
synced 2026-08-29 23:50:27 +08:00
17 lines
372 B
Python
17 lines
372 B
Python
|
|
#!/usr/bin/env python3
|
||
|
|
|
||
|
|
import asyncio
|
||
|
|
import websockets
|
||
|
|
|
||
|
|
async def hello():
|
||
|
|
uri = "ws://localhost:6001"
|
||
|
|
async with websockets.connect(uri) as websocket:
|
||
|
|
await websocket.send('{"jsonrpc": "2.0", "method": "clear", "id": 5}')
|
||
|
|
result = await websocket.recv()
|
||
|
|
print("result: ", result)
|
||
|
|
|
||
|
|
asyncio.get_event_loop().run_until_complete(hello())
|
||
|
|
|
||
|
|
|
||
|
|
|