Skip to main content

nao-websocket-bridge-client

Async laptop client for the microphone WebSocket on a NAO. It reads the format announcement, PCM frames, and status messages from nao-websocket-bridge-protocol.

Speech, motion, and buttons are naoqi-control on ports 9559 and 9561. The process that sends audio is nao-websocket-bridge, on port 8765.

Requires Python 3.10+.

uv add nao-websocket-bridge-client

Run uv add inside an existing Python project. Alternatively, in an activated Python 3.10+ environment on Linux or Windows, run python -m pip install nao-websocket-bridge-client. The protocol is installed automatically; the robot bridge must be installed separately on the NAO.

Read the microphone

The first frame must be the audio format. iter_bridge_messages checks it, then yields ("format", dict), ("pcm", bytes), and ("text", dict) for status and any other JSON.

import asyncio
from nao_websocket_bridge_client import iter_bridge_messages, websocket_url

async def main() -> None:
    url = websocket_url("192.168.2.50", 8765, token="")
    async for kind, payload in iter_bridge_messages(url):
        if kind == "pcm":
            print(len(payload))

asyncio.run(main())

With a bridge token, pass it to websocket_url or use ws://192.168.2.50:8765/choose-a-secret.

A terminal check prints RMS for each PCM chunk:

python -m nao_websocket_bridge_client --url ws://192.168.2.50:8765

Probing and reconnecting

tcp_accepts(host, port) is true when port 8765 accepts a TCP connection. wait_until_tcp_accepts(host, port, delay) returns as soon as it does, or after delay seconds. next_reconnect_delay(previous, held_secs) is the wait before another attempt: a socket that stayed up at least 2 seconds retries after 0.5 seconds; one that dies immediately doubles the wait, up to 8 seconds.

Local development

With this checkout next to the app:

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

Restore that project's pyproject.toml and lockfile before committing. The committed dependency stays the PyPI release.

Metadata

Release files for nao-websocket-bridge-client 0.1.1

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-client 0.1.1
File Size Uploaded Provenance Actions
nao_websocket_bridge_client-0.1.1.tar.gz 8.8 kB Without provenance Details for nao_websocket_bridge_client-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for nao-websocket-bridge-client 0.1.1
File Interpreter ABI Platform Actions
nao_websocket_bridge_client-0.1.1-py3-none-any.whl Python 3 none any Details for nao_websocket_bridge_client-0.1.1-py3-none-any.whl

Total release size: 18.5 kB

Release files / nao_websocket_bridge_client-0.1.1.tar.gz

Download URL nao_websocket_bridge_client-0.1.1.tar.gz
Size 8.8 kB
Tags Source
SHA-256 checksum
How to use checksums
ff04f38ba50d307c75a04d7a88f22395a83160b7a3b76cef29b08e39358a21f8
BLAKE2b-256 checksum
How to use checksums
8d2f3ca763bdb1e1dcc2892b0731ad47e5c301fd7ae69abc4c1400f294d3308f
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_client-0.1.1-py3-none-any.whl

Download URL nao_websocket_bridge_client-0.1.1-py3-none-any.whl
Size 9.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8e2151bb86d1240a7b99c27d9855feee2029055c6e998918ca918ce8b623f91c
BLAKE2b-256 checksum
How to use checksums
94007b5859abc7f98fc157c2577af509677747307204fab260ec8b3eca709290
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-client 0.1.1

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

0.1.1 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