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
- Code changes
- Guidelines for DataChannel termination in Node.js
- mediasoup-demo: Refactor the message Bot with new DataChannel termination in mediasoup
New API
Feature overview
-
Allow the Node application to directly send text/binary messages to
mediasoup-workerC++ process so others can consume them usingDataConsumers. -
And vice-versa: allow the Node application to directly consume in Node messages send by
DataProducers.
Implementation
-
New
DirectTransport(created viarouter.createDirectTransport()) that uses the newPayloadChannel(UnixSocket pair between Node and C++) to send payload messages in both directions. -
Extend
DataProducerandDataConsumerclasses to not just work with SCTP capable transports (WebRtcTransport,PlainTransport,PipeTransport) but also with the newDirectTransport.- In the latter, there are no âSCTP stream parametersâ involved at all.
-
sctpStreamParametersare now optional inDataProducerOptions(just valid fordirectTransport.produceData()).- So
dataProducer/Consumer.sctpStreamParametersgetter can now returnundefined.
- So
-
Added
dataProducer/Consumer.typegetter, that can be âsctpâ or âdirectâ. -
transport.consumeData()(when in an SCTP capable transport) now accepts optional SCTP related parameters inDataConsumerOptionsto tell mediasoup how to deliver messages to the remote SCTP endpoint (see DataConsumerOptions definition):ordered?: boolean;maxPacketLifeTime?: number;maxRetransmits?: number;
-
Worker: Added a newmessagelog tag.