Interface IModuleOnWebRTCDataChannel


public interface IModuleOnWebRTCDataChannel

IModuleOnWebRTCDataChannel: method interface examples for the WebRTC data-channel module methods.

Since module methods must be implemented as instance methods on the module class, a module does not implement this interface. This interface only serves as an example of the method names and call signatures needed to implement these methods.

These methods fire only when the application enables data channels (webrtcEnableDataChannels) with the data-channel mode set to module (webrtcDataChannelMode). For one peer connection the callbacks are serialized and ordered: session create, then per channel open, its messages in arrival order and close, then session destroy exactly once. No callback fires for a channel after its close. Different peer connections dispatch concurrently.

These methods must return promptly; hand slow work to your own executor. They run on a bounded pool shared by every module-mode connection, so a callback that blocks delays unrelated connections, and inbound messages queued beyond webrtcDataChannelMaxPendingDispatchMessages are dropped with a warning.

  • Method Details

    • onWebRTCDataChannelSessionCreate

      void onWebRTCDataChannelSessionCreate(IWebRTCDataChannelSession session)
      Invoked when a peer connection's SCTP association is up and data channels can flow. Channels can be opened toward the client from here on via IWebRTCDataChannelSession.openChannel(String).
      Parameters:
      session - data-channel session
    • onWebRTCDataChannelSessionDestroy

      void onWebRTCDataChannelSessionDestroy(IWebRTCDataChannelSession session)
      Invoked once when a peer connection's data-channel session is torn down (connection close or SCTP disassociation), after every open channel has reported close.
      Parameters:
      session - data-channel session
    • onWebRTCDataChannelOpen

      void onWebRTCDataChannelOpen(IWebRTCDataChannel channel)
      Invoked when a channel becomes usable, whether the client opened it (IWebRTCDataChannel.isRemotelyOpened() true) or a module opened it via IWebRTCDataChannelSession.openChannel(String).
      Parameters:
      channel - data channel
    • onWebRTCDataChannelStringMessage

      void onWebRTCDataChannelStringMessage(IWebRTCDataChannel channel, String message)
      Invoked when a string message arrives on a channel. Each call carries one whole message.
      Parameters:
      channel - data channel
      message - message
    • onWebRTCDataChannelBinaryMessage

      void onWebRTCDataChannelBinaryMessage(IWebRTCDataChannel channel, byte[] message)
      Invoked when a binary message arrives on a channel. Each call carries one whole message. The array belongs to this call: to keep it beyond the call, copy it.
      Parameters:
      channel - data channel
      message - message
    • onWebRTCDataChannelClose

      void onWebRTCDataChannelClose(IWebRTCDataChannel channel)
      Invoked exactly once when a channel closes, whether the client closed it, a module closed it via IWebRTCDataChannel.close(), or the connection was torn down.
      Parameters:
      channel - data channel