Skip to main content

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
  • Native channel streaming, time synchronization, playback control, subscriptions, and status messages
  • Extensible handlers for parameters, services, client publishing, connection graphs, and assets

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())

Playback control

Playback control uses our native async server implementation; it does not depend on the Foxglove SDK. Supplying the recording time range advertises the playbackControl capability; the server accepts the foxglove.sdk.v1 subprotocol by default.

from robo_ws_bridge import (
    PlaybackCommand,
    PlaybackControlRequest,
    PlaybackState,
    PlaybackStatus,
    WebSocketBridgeServer,
)

server = WebSocketBridgeServer(playback_time_range=(start_time_ns, end_time_ns))

async def control(request: PlaybackControlRequest) -> PlaybackState:
    if request.seek_time is not None:
        await recording.seek(request.seek_time)
    await recording.set_speed(request.playback_speed)
    if request.playback_command is PlaybackCommand.PLAY:
        await recording.play()
    else:
        await recording.pause()
    return PlaybackState(
        status=PlaybackStatus.PLAYING if recording.is_playing else PlaybackStatus.PAUSED,
        current_time=recording.current_time,
        playback_speed=recording.speed,
        did_seek=request.seek_time is not None,
    )

server.on_playback_control(control)

Each server endpoint has a unique session ID so reconnecting Foxglove clients discard stale visualization state. Rotate it explicitly when switching runs:

await server.clear_session()

Status IDs provide the same small lifecycle for the Problems panel:

from robo_ws_bridge import StatusLevel

await server.send_status(StatusLevel.ERROR, "Playback failed", status_id="playback")
await server.remove_status(["playback"])

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.

Metadata

Release files for robo-ws-bridge 0.11.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for robo-ws-bridge 0.11.0
File Size Uploaded Provenance Actions
robo_ws_bridge-0.11.0.tar.gz 20.7 kB Without provenance Details for robo_ws_bridge-0.11.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for robo-ws-bridge 0.11.0
File Interpreter ABI Platform Actions
robo_ws_bridge-0.11.0-py3-none-any.whl Python 3 none any Details for robo_ws_bridge-0.11.0-py3-none-any.whl

Total release size: 43.5 kB

Release files / robo_ws_bridge-0.11.0.tar.gz

Download URL robo_ws_bridge-0.11.0.tar.gz
Size 20.7 kB
Tags Source
SHA-256 checksum
How to use checksums
3c709dec0ac30d04576630d7f39ab5d606bb9bb12dafa8a5b717d520cab7c546
BLAKE2b-256 checksum
How to use checksums
49f4d43b2655e9da1b07fa56542d9001562e7ae6ca08634704654bca848a5f11
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","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}

Release files / robo_ws_bridge-0.11.0-py3-none-any.whl

Download URL robo_ws_bridge-0.11.0-py3-none-any.whl
Size 22.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9a43508c2e3f69ee398911f9287c3fdc1b23d7353342c70358f06d96204352bc
BLAKE2b-256 checksum
How to use checksums
e7380e4d3fd7535eb7399370d018ac9c036285571754a481ca92502c7e47f6ba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","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}

Security for robo-ws-bridge 0.11.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page