Transport

Transport method is detected using regex on base_url parameter passed to Session object.

Base Class

class janus_client.JanusTransport(base_url: str, api_secret: Optional[str] = None, token: Optional[str] = None, **kwargs: dict)

Janus transport protocol interface

Manage Sessions and Transactions

__init__(base_url: str, api_secret: Optional[str] = None, token: Optional[str] = None, **kwargs: dict)

Create connection instance

Parameters:
  • base_url – Janus server address

  • api_secret – (optional) API key for shared static secret authentication

  • token – (optional) Token for shared token based authentication

abstract async _send(message: Dict) None

Really sends the message. Doesn’t return a response

static create_transport(base_url: str, api_secret: Optional[str] = None, token: Optional[str] = None, config: Dict = {}) JanusTransport

Create transport class

JanusSession will call this to create the transport class automatically using base_url parameter.

Args:

base_url (str): _description_ api_secret (str, optional): _description_. Defaults to None. token (str, optional): _description_. Defaults to None. config (Dict, optional): _description_. Defaults to {}.

Raises:

Exception: No transport class found Exception: More than 1 transport class found

Returns:

JanusTransport: Use this object to communicate with Janus server.

async dispatch_session_created(session_id: int) None

Override this method to get session created event

async dispatch_session_destroyed(session_id: int) None

Override this method to get session destroyed event

async info() Dict

Get info of Janus server. Will be overridden for HTTP.

static register_transport(protocol_matcher, transport_cls: JanusTransport) None

Register transport class

Pass in a regex matcher and it will be used to match base_url to the transport class.

HTTP

class janus_client.JanusTransportHTTP(base_url: str, api_secret: Optional[str] = None, token: Optional[str] = None, **kwargs: dict)

Janus transport through HTTP

async dispatch_session_created(session_id: str) None

Override this method to get session created event

async dispatch_session_destroyed(session_id: int) None

Override this method to get session destroyed event

async info() Dict

Get info of Janus server. Will be overridden for HTTP.

Websockets

class janus_client.JanusTransportWebsocket(**kwargs: dict)

Janus transport through HTTP

Manage Sessions and Transactions

connected: bool

Must set this property when connected or disconnected