rtc-data-stream
convert a reliable RTCDataChannel into a stream
use HTML5 WebRTC the node way -- with streams
use
you can use browserify to package this module for browser use.
var rtcDataStream = require('rtc-data-stream')
var quickconnect = require('rtc-quickconnect')
quickconnect({ ns: 'dctest', data: true }).on('dc:open', function(channel, peerId) {
var rtc = rtcDataStream(channel)
rtc.pipe(somewhereAwesome)
})
rtc
is a stream and speaks stream events: data
, error
and end
. that means you can pipe output to anything that accepts streams.
try
# install beefy
npm install -g beefy
# clone repo
git clone https://github.com/kumavis/rtc-data-stream
cd rtc-data-stream
# install dev dependencies
npm install
# start the example
npm start
# open another tab with the generated link
credit
Based on websocket-stream by max ogden
license
BSD LICENSE