RTSDK
    Preparing search index...

    Class WebRTCConnector

    WebRTC connector for managing real-time video and audio connections in Topia worlds.

    This class should NOT be instantiated directly. Use WebRTCConnectorFactory to create instances. The WebRTCConnector provides access to Twilio configuration needed for establishing peer-to-peer video and audio connections between visitors in a world.

    WebRTCConnectorFactory for proper instantiation

    webrtc, video, audio, twilio, real-time, communication, voice, peer

    import { WebRTC } from "utils/topiaInit.ts";

    const webrtc = await WebRTC.create(urlSlug, { credentials });
    const config = await webrtc.getTwilioConfig();

    Hierarchy (View Summary)

    Implements

    Index

    Other

    credentials: undefined | InteractiveCredentials
    jwt?: string
    requestOptions: object
    topia: Topia
    twilioConfig?: null | object
    urlSlug: string
    • Standardized error handler for all SDK operations.

      Parameters

      • __namedParameters: { error?: unknown; message?: string; params?: object; sdkMethod?: string }

      Returns {
          data: {};
          message: string;
          method: string;
          params: object;
          sdkMethod: undefined | string;
          stack: string;
          stackTrace: Error;
          status: number;
          success: boolean;
          url: string;
      }

      Standardized error object with properties: data, message, method, params, sdkMethod, stack, status, success, url

      This method processes errors from API calls and formats them consistently across the SDK. It extracts relevant error information including:

      • HTTP status codes and response data
      • Error messages from API responses
      • Stack traces for debugging
      • Request details (URL, method, parameters)

      All errors thrown by SDK methods flow through this handler to ensure consistent error format.

      error, exception, handler, debugging, api error, http error

    • Returns the configured Axios instance for making API calls to Topia's Public API.

      Returns AxiosInstance

      The configured Axios client instance with authentication headers.

      All HTTP requests to the Topia API should use this method to ensure proper authentication headers and base URL configuration are applied.

      api, axios, http, request, client, public api

    WebRTC

    • Retrieves the Twilio configuration for WebRTC connections in a world.

      Returns Promise<void | ResponseType>

      Populates twilioConfig property with Twilio room configuration, or returns an error response.

      This method fetches the Twilio room configuration needed to establish peer-to-peer video and audio connections between visitors. The configuration includes authentication tokens and room settings. Call this before initializing WebRTC connections.

      get, fetch, retrieve, webrtc, twilio, configuration, video, audio, connection

      await webRTCConnector.getTwilioConfig();
      const { twilioConfig } = webRTCConnector;
      console.log(twilioConfig); // Use for WebRTC setup