Skip to main content

Streaming session

The Streaming sessions endpoint performs several critical functions:

  • Creates a unique Room on the WebRTC server to facilitate upcoming audio publishing.
  • Registers a connection at the WebSocket translation management API.
  • Provides a set of JWT access tokens in the response, which is required to connect to the WebRTC server and the WebSocket translation management API.

The JWT access token contains specific permissions that may limit access to certain API functionalities. These restrictions ensure the secure and appropriate use of the streaming and translation capabilities. The response object contains two types of tokens: publisher and subscriber.

  • publisher tokens are used to publish audio streams to the WebRTC server and have read, edit and write permissions for translation tasks.
  • subscriber tokens are used to receive translated audio streams from the server and have only read and edit permissions for translation tasks.

Streaming Session: Allows clients to publish a real-time communication (RTC) stream to the server.

Audio Reception: Clients receive the translated audio stream from the server.

Translation Management: Clients can manage translation options dynamically through the WebSocket API during the session.

HTTP Request

POST /session-storage/sessions

Headers

  • ClientID: The unique identifier of the client application.
  • ClientSecret: The secret key of the client application.

Payload

{
"data": {
"publisher_count": 1,
"subscriber_count": 3
}
}

Response Structure

For a successful request, the endpoint returns a JSON object containing the follow fields:

  • publisher: A list of JWT tokens required for subsequent connections to the WebRTC and WebSocket APIs with RWE permissions.
  • subscriber: A list of JWT tokens required for subsequent connections to the WebRTC and WebSocket APIs with RE permissions.
  • room_name: The name of the created room on the LiveKit server.
  • stream_url: The WebRTC server URL where the audio stream will be published.
  • control_url: A WebSocket URL you can use to manage the translation settings and pipeline.

Example Response

{
"ok": true,
"data": {
"publisher": ["list", "of", "publisher", "jwt", "tokens"],
"subscriber": ["list", "of", "subscriber", "jwt", "tokens"],
"room_name": "00000000",
"stream_url": "http://localhost:3000",
"control_url": "ws://localhost:6000/speech-to-speech/stream"
}
}