StreamConnection constructor

StreamConnection(
  1. String peerId,
  2. Peer provider,
  3. dynamic options
)

Implementation

StreamConnection(String peerId, Peer provider, dynamic options)
    : super(peerId, provider, {...options, 'reliable': true}) {
  // Listen to the send stream and process the chunks
  _sendController.stream.transform(_chunkTransformer()).listen((chunk) {
    _sendChunk(chunk);
  });

  // Listen to the receive stream and process the messages
  _receiveController.stream.listen((message) {
    emit('data', message);
  });
}