mediasoup 3.6.0 is out with DataChannel termination in Node.js

mediasoup 3.6.0 is out. It comes with a new DirectTransport to send/receive data messages directly from/to Node.js to the mediasoup C++ Router, so those messages can be sent/received by remote WebRTC endpoints.

References

New API

Feature overview

  • Allow the Node application to directly send text/binary messages to mediasoup-worker C++ process so others can consume them using DataConsumers.

  • And vice-versa: allow the Node application to directly consume in Node messages send by DataProducers.

Implementation

  • New DirectTransport (created via router.createDirectTransport()) that uses the new PayloadChannel (UnixSocket pair between Node and C++) to send payload messages in both directions.

  • Extend DataProducer and DataConsumer classes to not just work with SCTP capable transports (WebRtcTransport, PlainTransport, PipeTransport) but also with the new DirectTransport.

    • In the latter, there are no “SCTP stream parameters” involved at all.
  • sctpStreamParameters are now optional in DataProducerOptions (just valid for directTransport.produceData()).

    • So dataProducer/Consumer.sctpStreamParameters getter can now return undefined.
  • Added dataProducer/Consumer.type getter, that can be ‘sctp’ or ‘direct’.

  • transport.consumeData() (when in an SCTP capable transport) now accepts optional SCTP related parameters in DataConsumerOptions to tell mediasoup how to deliver messages to the remote SCTP endpoint (see DataConsumerOptions definition):

    • ordered?: boolean;
    • maxPacketLifeTime?: number;
    • maxRetransmits?: number;
  • Worker: Added a new message log tag.

Wow!

I installed media soup for the first time yesterday, and was trying to figure out why mediasoup couldn’t find the createDirectTransport method. This is great, will be upgrading now. Thanks!