• Iñaki Baz Castillo's avatar
    Datachannel termination via the new DirectTransport (#409) · b7a39717
    由 Iñaki Baz Castillo 提交于
    Fixes #400
    
    ### Feature overview
    
    - Allow the Node application to directly send text/binary messages to `mediasoup-worker` C++ process so others can consume them using `DataConsumer`.
    
    - 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:
    
      ordered?: boolean;
      maxPacketLifeTime?: number;
      maxRetransmits?: number;
    
    - `Worker`: Added a new `direct` log tag.
    b7a39717
DataConsumer.js 4.9 KB