Channel

class omni.kit.collaboration.channel_manager.Channel(handler: <module 'weakref' from '/builds/packman/python/3.10.5-1-linux-x86_64/lib/python3.10/weakref.py'>, channel_manager: <module 'weakref' from '/builds/packman/python/3.10.5-1-linux-x86_64/lib/python3.10/weakref.py'>)

Bases: object

Channel represents the instance of an Nucleus Channel.

Methods

__init__(handler, channel_manager)

Internal constructor.

add_subscriber(on_message)

Add subscriber.

send_message_async(content)

Async function.

stop()

Attributes

logged_user_id

The user id that logs in this channel.

logged_user_name

The user name that logs in this channel.

peer_users

All the peer clients that joined to this channel.

stopped

Whether channel is stopped or not.

url

__init__(handler: <module 'weakref' from '/builds/packman/python/3.10.5-1-linux-x86_64/lib/python3.10/weakref.py'>, channel_manager: <module 'weakref' from '/builds/packman/python/3.10.5-1-linux-x86_64/lib/python3.10/weakref.py'>) None

Internal constructor.

add_subscriber(on_message: Callable[[Message], None]) ChannelSubscriber

Add subscriber.

Parameters

on_message (Callable[[Message], None]) – The message handler.

Returns

Instance of ChannelSubscriber. The channel will be stopped if instance is release. So it needs to hold the instance before it’s stopped. You can manually call `stop` to stop this channel, or set the returned instance to None.

async send_message_async(content: dict) Request

Async function. Send message to all peer clients.

Parameters

content (dict) – The message composed in dictionary.

Returns

omni.client.Request.

property logged_user_id

The user id that logs in this channel.

property logged_user_name

The user name that logs in this channel.

property peer_users: Dict[str, PeerUser]

All the peer clients that joined to this channel.

property stopped

Whether channel is stopped or not.