Nocturna
    Preparing search index...

    RemoteParticipant manages a WebRTC peer-to-peer connection and data channel with a single remote player.

    • Handles offer/answer exchange and ICE candidate negotiation.
    • Manages the RTCDataChannel for sending and receiving game data.
    • Notifies the observer of incoming messages.
    • Integrates with a signaling implementation for connection setup.
    Index

    Constructors

    Properties

    id: string

    The unique ID of the remote participant.

    Methods

    • Adds an ICE candidate to the peer connection.

      Parameters

      • candidate: RTCIceCandidateInit

        The ICE candidate to add.

      Returns Promise<void>

    • Handles an incoming offer and responds with an answer (callee).

      Parameters

      • offer: RTCSessionDescriptionInit

        The received RTC session description offer.

      Returns Promise<void>

    • Initiates a WebRTC connection as the caller (creates offer and data channel).

      Returns Promise<void>

    • Handles an incoming answer to a previously sent offer.

      Parameters

      • answer: RTCSessionDescriptionInit

        The received RTC session description answer.

      Returns Promise<void>

    • Handles an incoming message from the data channel and notifies the observer.

      Parameters

      • event: MessageEvent

        The message event.

      Returns void

    • Sends a message to the remote participant via the data channel.

      Parameters

      • id: string

        The sender's ID.

      • action: string

        The action type.

      • data: any

        The data payload.

      Returns void