-
-
Notifications
You must be signed in to change notification settings - Fork 195
statusServer web sockets python example
hayden-t edited this page Feb 25, 2022
·
9 revisions
statusServer settings configures Trunk Recorder to send status messages regularly and on events to a server for processing/output.
It uses the websockets protocol, and is in the following json format https://github.com/robotastic/trunk-recorder/blob/master/docs/notes/STATUS-JSON.md
Here is a simple python script example that simple print the messages received from trunk recorder. From here you can do what ever you need with the data.
add to config:
"statusServer":"ws://127.0.0.1:8000/"
run:
#!/usr/bin/env python3
import asyncio
import websockets
import json
async def echo(websocket, path):
while True:
message = await websocket.recv()
print(message) #print every message, comment to filter
data = json.loads(message)
#if data['type'] == 'recorder':#uncomment to filter, adjust as needed
#print(message)#uncomment to filter
start_server = websockets.serve(echo, "127.0.0.1", 8000)
asyncio.get_event_loop().run_until_complete(start_server)
asyncio.get_event_loop().run_forever()
- What is Trunk-Recorder?
- Roadmap (TBD)
- Enhancements
- FAQ's
- Global FAQ's
- HackRF FAQ's
- RTLSDR FAQ's