Interface IWebRTCDataChannelSession


public interface IWebRTCDataChannelSession

IWebRTCDataChannelSession: the data-channel side of one WebRTC peer connection (one client), as exposed to server-side modules. A session becomes available to modules through the onWebRTCDataChannelSessionCreate special function once the connection's SCTP association is up, and goes away with onWebRTCDataChannelSessionDestroy.

A session wraps exactly one peer connection, so everything on it is scoped to that one client: channels opened here reach only that client, and messages from that client surface only through this session's channels. Routing across clients (fan-out, chat rooms, directed messages) is module logic, built by selecting sessions via getStreamName(), isPublisher() and getConnectionId().

Requires the application's data-channel mode to be module (WebRTC property webrtcDataChannelMode).

  • Method Summary

    Modifier and Type
    Method
    Description
    The application instance this connection belongs to.
    Snapshot of this session's currently open channels.
    The connection id of the underlying peer connection.
    Per-session property collection modules can use to attach their own state for the lifetime of the session.
    The RTP session of the underlying peer connection, the same object surfaced to modules through onRTPSessionCreate.
    The stream name the connection signaled (publish or play target).
    default String
    The stream target's map-file entry name, or null when this is not a stream-target session or the target has no entry name.
    boolean
    True when the connection publishes media to WSE (ingest), false when it plays (egress).
    default boolean
    True when this session is a server-side stream target pushing media out of WSE, rather than a client playing it back.
    void
    Opens a data channel toward this session's client (WSE-initiated, reliable and ordered).
  • Method Details

    • getAppInstance

      IApplicationInstance getAppInstance()
      The application instance this connection belongs to.
      Returns:
      application instance
    • getStreamName

      String getStreamName()
      The stream name the connection signaled (publish or play target).
      Returns:
      stream name
    • getConnectionId

      String getConnectionId()
      The connection id of the underlying peer connection. It is the same value the client received during signaling and the same value returned by getRTPSession().getSessionId(), so it can be used to correlate with the client side, with onRTPSessionCreate and with server logs.
      Returns:
      connection id
    • isPublisher

      boolean isPublisher()
      True when the connection publishes media to WSE (ingest), false when it plays (egress).
      Returns:
      true for a publisher connection
    • isStreamTarget

      default boolean isStreamTarget()
      True when this session is a server-side stream target pushing media out of WSE, rather than a client playing it back. A stream target is always egress, so isPublisher() is false for both and this is what tells them apart. Independent of getStreamTargetName(), which a target is not required to have.
      Returns:
      true for a stream-target connection
    • getStreamTargetName

      default String getStreamTargetName()
      The stream target's map-file entry name, or null when this is not a stream-target session or the target has no entry name. Stable across the target's reconnects, unlike getConnectionId(): a reconnect tears the peer connection down and builds a new one, so a module sees a session destroy/create pair with a new connection id but the same target name. Key per-target module state on this, falling back to isStreamTarget() when it is absent.
      Returns:
      stream target entry name, or null
    • getRTPSession

      RTPSession getRTPSession()
      The RTP session of the underlying peer connection, the same object surfaced to modules through onRTPSessionCreate. Null if the RTP session is not available.
      Returns:
      RTP session or null
    • openChannel

      void openChannel(String label)
      Opens a data channel toward this session's client (WSE-initiated, reliable and ordered). Asynchronous: the channel surfaces through the onWebRTCDataChannelOpen special function once it is ready, with isRemotelyOpened() false.
      Parameters:
      label - channel label
    • getChannels

      Snapshot of this session's currently open channels.
      Returns:
      open channels
    • getProperties

      WMSProperties getProperties()
      Per-session property collection modules can use to attach their own state for the lifetime of the session.
      Returns:
      session properties