Skip to main content

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.7.0.tar.gz (15.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

robo_ws_bridge-0.7.0-py3-none-any.whl (17.5 kB view details)

Uploaded Python 3

File details

Details for the file robo_ws_bridge-0.7.0.tar.gz.

File metadata

  • Download URL: robo_ws_bridge-0.7.0.tar.gz
  • Upload date:
  • Size: 15.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","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

Hashes for robo_ws_bridge-0.7.0.tar.gz
Algorithm Hash digest
SHA256 4f3363787adf0db0ee68e86f98503cc8e6295e7d5007e7acf825ad43f7e29df7
MD5 4c6422edd70a895cc87b5170e766edaf
BLAKE2b-256 0e05469f6127b97242b040109fa5d8b029b3885b6bd4f614bfa01f4f97366872

See more details on using hashes here.

File details

Details for the file robo_ws_bridge-0.7.0-py3-none-any.whl.

File metadata

  • Download URL: robo_ws_bridge-0.7.0-py3-none-any.whl
  • Upload date:
  • Size: 17.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","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

Hashes for robo_ws_bridge-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1d2f885a526d35c4e1a82bbb904bf32e4032089f8b492b3793b4c95f94079e1c
MD5 2bce6391c2df98f55a7f80e3b5c7a546
BLAKE2b-256 586b4bcf33ca869080c0a58b54a725b749e65bc3587540798acb907dbbbee4a8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page