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 Type
    Method
    Description
    void
    Closes the channel from the WSE side.
    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.
    int
    The SCTP stream id carrying this channel.
    boolean
    True until the channel is closed (by either side or by connection teardown).
    boolean
    True when delivery preserves send order.
    boolean
    True when the client opened this channel, false when it was opened from the WSE side via IWebRTCDataChannelSession.openChannel(String).
    boolean
    sendBinary(byte[] message)
    Sends a binary message to this channel's client.
    boolean
    sendString(String message)
    Sends a string message to this channel's client.
  • Method Details

    • 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 via IWebRTCDataChannelSession.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

      boolean sendString(String message)
      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; the onWebRTCDataChannelClose special 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