Skip to main content

Typed Janus and DataChannel client for the Janus TextRoom plugin

Project description

janus-textroom-plugin

Typed bindings for janus.plugin.textroom, packaged independently from janus-api-core and other named plugins.

TextRoom has two intentionally separate protocols:

  • Janus plugin messages establish/restart the data-only PeerConnection and perform synchronous room administration using a request field.
  • Chat participation travels as UTF-8 JSON over a DataChannel using a textroom field and a mandatory transaction.
from janus_api.models.base import Jsep
from janus_textroom_plugin import TextRoomPlugin

textroom = TextRoomPlugin(session=session)
await textroom.attach()
offer = await textroom.setup()
# Apply offer.jsep in the WebRTC implementation, create the data channel,
# then return the local answer.
await textroom.ack(Jsep(type="answer", sdp=answer_sdp))

textroom.bind_datachannel(channel)
await textroom.join(1234, "alice", display="Alice")
await textroom.message(1234, "Hello everyone")

Room administration is deliberately independent of the WebRTC transport:

await textroom.create_room(
    room=1234,
    description="Support",
    secret="room-admin-secret",
    history=50,
)
rooms = await textroom.list_rooms()
participants = await textroom.list_participants(1234)

DataChannelLike is a small adapter protocol (ready_state plus send). Incoming channel payloads must be handed to feed_datachannel(). The transaction manager bounds pending requests, event backlog, and payload size; it applies per-request timeouts and deterministically fails pending futures when closed or cancelled. It does not close the application's underlying WebRTC transport. Feed each incoming UTF-8 frame back to textroom.feed_datachannel(payload) on the channel's owning event loop.

Room list/create/edit/destroy/exists/ACL queries use Janus messages. Join, message, announcement, leave, and kick use the DataChannel and can never be accidentally serialized into the Janus plugin body.

All operations accept a per-call timeout. Applications should call await textroom.aclose() during shutdown so outstanding transaction waiters are failed deterministically before the Janus handle is detached.

See the official TextRoom API.

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

janus_textroom_plugin-3.0.0.tar.gz (16.7 kB view details)

Uploaded Source

Built Distribution

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

janus_textroom_plugin-3.0.0-py3-none-any.whl (13.1 kB view details)

Uploaded Python 3

File details

Details for the file janus_textroom_plugin-3.0.0.tar.gz.

File metadata

File hashes

Hashes for janus_textroom_plugin-3.0.0.tar.gz
Algorithm Hash digest
SHA256 8856899294be3563ff838fcbcbfdd698418c2971adb197c0f078447a13ac027c
MD5 fa1775759155ebbd149c34b630b30df6
BLAKE2b-256 4997acf0140e7182314b7d6efc112ee9ea8ee267ef4ae0ed153be89bfc724b69

See more details on using hashes here.

File details

Details for the file janus_textroom_plugin-3.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for janus_textroom_plugin-3.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ea2592cbf1b5d59a9353292635bf8e96db5e21386fa6c1659880729252994290
MD5 622f05be1355a3acab6b09c51488a0ac
BLAKE2b-256 33b104cd44ad3649592337fea84552d28eec26d071281ad3f10671612ae46f2e

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