Package com.wowza.wms.webrtc.datachannel
Interface IWebRTCDataChannel
public interface IWebRTCDataChannel
IWebRTCDataChannel: one WebRTC data channel (RFC 8831) between WSE and the client of one peer
connection, as exposed to server-side modules. Channels surface through the
onWebRTCDataChannelOpen special function, deliver inbound messages through
onWebRTCDataChannelStringMessage / onWebRTCDataChannelBinaryMessage, and report close
through onWebRTCDataChannelClose.
A channel is point-to-point: sends reach only the client of the session the channel belongs to. Sends are asynchronous and thread-safe, so they may be called from any thread, not only from inside the data-channel special functions.
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes the channel from the WSE side.getLabel()The channel label negotiated on open.Per-channel property collection modules can use to attach their own state for the lifetime of the channel.The session (peer connection) this channel belongs to.intThe SCTP stream id carrying this channel.booleanisOpen()True until the channel is closed (by either side or by connection teardown).booleanTrue when delivery preserves send order.booleanTrue when the client opened this channel, false when it was opened from the WSE side viaIWebRTCDataChannelSession.openChannel(String).booleansendBinary(byte[] message) Sends a binary message to this channel's client.booleansendString(String message) Sends a string message to this channel's client.
-
Method Details
-
getSession
IWebRTCDataChannelSession getSession()The session (peer connection) this channel belongs to.- Returns:
- owning session
-
getLabel
String getLabel()The channel label negotiated on open.- Returns:
- channel label
-
getStreamId
int getStreamId()The SCTP stream id carrying this channel. Unique per session while the channel is open.- Returns:
- SCTP stream id
-
isOrdered
boolean isOrdered()True when delivery preserves send order.- Returns:
- true for an ordered channel
-
isRemotelyOpened
boolean isRemotelyOpened()True when the client opened this channel, false when it was opened from the WSE side viaIWebRTCDataChannelSession.openChannel(String).- Returns:
- true for a client-opened channel
-
isOpen
boolean isOpen()True until the channel is closed (by either side or by connection teardown).- Returns:
- true while open
-
sendString
Sends a string message to this channel's client. Non-blocking: the message is queued for asynchronous delivery.- Parameters:
message- message to send- Returns:
- true if the message was queued; false if it was not (channel closed, message at or above the negotiated maximum message size, or the channel's outbound buffer is full)
-
sendBinary
boolean sendBinary(byte[] message) Sends a binary message to this channel's client. Non-blocking: the message is queued for asynchronous delivery.The array is not copied and delivery happens after this call returns, so modifying it afterwards corrupts what is sent.
- Parameters:
message- message to send- Returns:
- true if the message was queued; false if it was not (channel closed, message at or above the negotiated maximum message size, or the channel's outbound buffer is full)
-
close
void close()Closes the channel from the WSE side. The peer observes the close; theonWebRTCDataChannelClosespecial function fires exactly once regardless of which side closed first. -
getProperties
WMSProperties getProperties()Per-channel property collection modules can use to attach their own state for the lifetime of the channel.- Returns:
- channel properties
-