Skip to main content

Ozobot WebRTC library

Project description

ozobot-webrtc

A Python library for establishing WebRTC connections with Ozobot devices, enabling real-time communication through data channels. This is a backend library implementing bare WebRTC functionality. Consult your robot documentation to learn which user library can control your robot.

Features

  • WebRTC peer-to-peer connections with Ozobot devices
  • AMQP-based signaling through WebSocket or TCP transports to estabilish the connection
  • Built on aiortc for WebRTC functionality

Basic Usage

import asyncio

from ozobot.webrtc.signaling import SignalingCaller
from ozobot.webrtc.messaging import create_channel_factory, MessagingChannelConfig

async def main() -> None:
  # Configure messaging
  config = MessagingChannelConfig(
    device_id="your-connection-key",
    username="your-username", 
    password="your-password"
  )

  # Establish connection
  async with create_channel_factory(config) as factory:
    caller = SignalingCaller(factory, "your-queue-name")
    connection, channels = await caller.signal(channels=("control",))

    # Use the data channels
    data_channel = channels[0]
    await data_channel.send(b"Hello Ozobot!")

    async for data in channel.receive_str():
      print(data)


if __name__ == "__main__":
    asyncio.run(main())

jwt authentication

If you don't have an username and password, you need to use jwt for authentication. In that case, use get_jwt_token from ozobot.webrtc.signaling.token and use the resulting value as password. Keep username empty:

from ozobot.webrtc.signaling.token import get_jwt_token, TOKEN_ENDPOINT_URL
await token = await get_jwt_token(TOKEN_ENDPOINT_URL, "your-connection-key", "server")
config = MessagingChannelConfig(
    device_id="your-connection-key",
    username="", 
    password=token,
)

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

ozobot_webrtc-0.1.2.tar.gz (10.0 kB view details)

Uploaded Source

Built Distribution

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

ozobot_webrtc-0.1.2-py3-none-any.whl (13.6 kB view details)

Uploaded Python 3

File details

Details for the file ozobot_webrtc-0.1.2.tar.gz.

File metadata

  • Download URL: ozobot_webrtc-0.1.2.tar.gz
  • Upload date:
  • Size: 10.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ozobot_webrtc-0.1.2.tar.gz
Algorithm Hash digest
SHA256 35df80aaf1be3561f7e53bb20e2ace9d07abba17108f502ae307d591f9cbead9
MD5 23abcdc9ecd72217c2877fb0c6e3cefb
BLAKE2b-256 6ac41447c5a15cf590401fb0ca76d333544e9fb3a3a24dfdc8553b28b1173777

See more details on using hashes here.

Provenance

The following attestation bundles were made for ozobot_webrtc-0.1.2.tar.gz:

Publisher: publish.yml on ozobot/python-libraries

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ozobot_webrtc-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: ozobot_webrtc-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 13.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ozobot_webrtc-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 afff5bbd13757cbf447f6a0aefddea714883d9f2aeb1ce578963218e5bf6056f
MD5 f39bff5ca6cbdd66f231b7483ca9e285
BLAKE2b-256 e84ade8c536ec557ec4a90e7ac02cb872c78471eb85c579a33439a3051d6ac46

See more details on using hashes here.

Provenance

The following attestation bundles were made for ozobot_webrtc-0.1.2-py3-none-any.whl:

Publisher: publish.yml on ozobot/python-libraries

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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