Python library implementing the Foxglove WebSocket protocol for streaming robotics data
Project description
robo-ws-bridge
A Python library implementing the Foxglove WebSocket protocol for streaming robotics data.
Installation
uv add robo-ws-bridge
Features
- WebSocketBridgeServer: Async server for publishing robotics data over WebSocket
- WebSocketBridgeClient: Async client for subscribing to data streams
- Full support for Foxglove WebSocket protocol messages (advertise, subscribe, publish, etc.)
Usage
Server Example
import asyncio
from robo_ws_bridge.server import Channel
from robo_ws_bridge import WebSocketBridgeServer
async def main():
server = WebSocketBridgeServer(host="0.0.0.0", port=8765, name="my-server")
# Define and advertise a channel
channel = Channel(
id=1,
topic="/sensor/data",
encoding="json",
schema_name="SensorData",
schema='{"type": "object"}',
)
await server.start()
await server.advertise_channel(channel)
# Publish messages
while True:
data = b'{"temperature": 22.5}'
await server.publish_message(channel.id, data)
await asyncio.sleep(0.1)
asyncio.run(main())
Client Example
import asyncio
from robo_ws_bridge import WebSocketBridgeClient
async def main():
client = WebSocketBridgeClient("ws://localhost:8765")
async def handle_message(channel, timestamp, data):
print(f"{channel['topic']}: {data}")
async def handle_advertise(channel):
await client.subscribe(channel["topic"])
client.on_message(handle_message)
client.on_advertised_channel(handle_advertise)
await client.connect()
# Keep running until interrupted
try:
while True:
await asyncio.sleep(1)
finally:
await client.disconnect()
asyncio.run(main())
Protocol Reference
See the Foxglove WebSocket Protocol for protocol details.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
robo_ws_bridge-0.4.0.tar.gz
(12.7 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file robo_ws_bridge-0.4.0.tar.gz.
File metadata
- Download URL: robo_ws_bridge-0.4.0.tar.gz
- Upload date:
- Size: 12.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b3c047b6d265af558fcc259c9dd815faceef362df135ea12438bcccd5c114af9
|
|
| MD5 |
ac7e01a09e377dd005d3f26c0f6e9c30
|
|
| BLAKE2b-256 |
2cc56799c2689a9dd490dde5fb832ee57bd4baec5a33ea1f9e63f12c10a36b72
|
File details
Details for the file robo_ws_bridge-0.4.0-py3-none-any.whl.
File metadata
- Download URL: robo_ws_bridge-0.4.0-py3-none-any.whl
- Upload date:
- Size: 15.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ee461701a2a80c76d26766c772ded560e7ea8fa9c4d9d14437879f65084ed44c
|
|
| MD5 |
7d05e1c1c6c87140efe12a9c4aac9cd0
|
|
| BLAKE2b-256 |
865abbf0f35f73bfe13914581d0471d0eb7c7ddc45411e7f17e18d31fe2a3260
|