websocket_client.py
Go to the documentation of this file.
1 #!/usr/bin/python
2 
3 # https://pypi.org/project/websocket_client/
4 
5 import websocket
6 import math
7 import json
8 from time import sleep
9 
10 ws = websocket.WebSocket()
11 ws.connect("ws://localhost:9871")
12 
13 time = 0.0
14 
15 while True:
16  sleep(0.05)
17  time += 0.05
18 
19  data = {
20  "timestamp": time,
21  "test_data": {
22  "cos": math.cos(time),
23  "sin": math.sin(time)
24  }
25  }
26  ws.send( json.dumps(data) )


plotjuggler
Author(s): Davide Faconti
autogenerated on Sun Dec 6 2020 04:02:48