Skip to main content

nao-websocket-bridge-protocol

WebSocket message contract for the microphone bridge between a NAO and a laptop. No third-party imports and no type annotations, so the same file loads on the robot's Python 2.7 and on Python 3.

The bridge install copies the package onto the robot next to audio_bridge.py. Laptops install it from PyPI. nao-websocket-bridge-client is the async reader.

uv add nao-websocket-bridge-protocol

Run uv add inside an existing Python project, or install into an activated Python 3.10+ environment on Linux or Windows with python -m pip install nao-websocket-bridge-protocol. Python 2.7 on the NAO uses the copied source, not this Python 3 package installation.

Messages

The first frame is text JSON:

{"type": "audio_format", "encoding": "pcm_s16le", "sample_rate": 16000, "channels": 1, "sample_width": 2}

Every later binary frame is that PCM: 16 kHz, mono, signed 16-bit little-endian. The bridge also sends status frames:

{"type": "status", "dropped_chunks": 0, "subscribed": true}

dropped_chunks counts microphone buffers the bridge could not queue. subscribed is whether the front microphone is subscribed. validate_audio_format checks the keys above and ignores any other fields. message_type returns the type of a decoded JSON object.

from nao_websocket_bridge_protocol import (
    audio_format_message,
    status_message,
    validate_audio_format,
    websocket_url,
)

websocket_url("192.168.2.50", 8765)             # ws://192.168.2.50:8765
websocket_url("192.168.2.50", 8765, "secret")   # ws://192.168.2.50:8765/secret

path_is_authorized accepts every path when the token is empty. Otherwise the path must be / plus the token.

SAMPLE_RATE is 16000, CHANNELS is 1, SAMPLE_WIDTH_BYTES is 2, and FRONT_MIC is 3 (the ALAudioDevice channel the bridge subscribes).

Local development

With this checkout next to another project:

uv add --editable ../nao-websocket-bridge-protocol

Restore that project's pyproject.toml and lockfile before committing. The bridge install copies these files onto the robot on its own.

Metadata

Release files for nao-websocket-bridge-protocol 1.1.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 nao-websocket-bridge-protocol 1.1.0
File Size Uploaded Provenance Actions
nao_websocket_bridge_protocol-1.1.0.tar.gz 7.7 kB Without provenance Details for nao_websocket_bridge_protocol-1.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for nao-websocket-bridge-protocol 1.1.0
File Interpreter ABI Platform Actions
nao_websocket_bridge_protocol-1.1.0-py2.py3-none-any.whl Python 2, Python 3 none any Details for nao_websocket_bridge_protocol-1.1.0-py2.py3-none-any.whl

Total release size: 15.5 kB

Release files / nao_websocket_bridge_protocol-1.1.0.tar.gz

Download URL nao_websocket_bridge_protocol-1.1.0.tar.gz
Size 7.7 kB
Tags Source
SHA-256 checksum
How to use checksums
25ce8e03a68f101e8294c936e5c1aaf09af5bad8bc202082c39e72a1c56dbb39
BLAKE2b-256 checksum
How to use checksums
748afb824cdd41b719b28f79e06c4abe3aefdec17eac1cf7e95876c4c1863884
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.15

Release files / nao_websocket_bridge_protocol-1.1.0-py2.py3-none-any.whl

Download URL nao_websocket_bridge_protocol-1.1.0-py2.py3-none-any.whl
Size 7.7 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
c2dfbb48efc6aa6dc4b2af3ee58a30b45720130d6bfb069d84c06f0318a9c04a
BLAKE2b-256 checksum
How to use checksums
63c1392343c38ea525cbab3d94022581eca6f410a077a78ec298c7272b00f231
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.15

Security for nao-websocket-bridge-protocol 1.1.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.

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files No provenance

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