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 TypeMethodDescriptionThe 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 throughonRTPSessionCreate.The stream name the connection signaled (publish or play target).default StringThe stream target's map-file entry name, or null when this is not a stream-target session or the target has no entry name.booleanTrue when the connection publishes media to WSE (ingest), false when it plays (egress).default booleanTrue when this session is a server-side stream target pushing media out of WSE, rather than a client playing it back.voidopenChannel(String label) 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 bygetRTPSession().getSessionId(), so it can be used to correlate with the client side, withonRTPSessionCreateand 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, soisPublisher()is false for both and this is what tells them apart. Independent ofgetStreamTargetName(), which a target is not required to have.- Returns:
- true for a stream-target connection
-
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, unlikegetConnectionId(): 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 toisStreamTarget()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 throughonRTPSessionCreate. Null if the RTP session is not available.- Returns:
- RTP session or null
-
openChannel
Opens a data channel toward this session's client (WSE-initiated, reliable and ordered). Asynchronous: the channel surfaces through theonWebRTCDataChannelOpenspecial function once it is ready, withisRemotelyOpened()false.- Parameters:
label- channel label
-
getChannels
Collection<IWebRTCDataChannel> 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
-