Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

33 lines (24 sloc) 0.82 kb
# Express.js. Serving /stream and /mirror
express = require('express')
app = express.createServer(express.logger())
app.set('view engine', 'jade');
app.use('/js', express.static(__dirname + '/js'));
port = 9000 || process.env.PORT || 3000;
app.listen port, ->
console.log("Listening on " + port);
app.get '/stream', (req, res) ->
res.render('stream');
app.get '/mirror', (req, res) ->
res.render('mirror');
# Pusher Pipe. Streaming data over WebSockets
Pipe = require('pusher-pipe')
client = Pipe.createClient {
key: 'your key'
secret: 'your secret'
app_id: 'your app id'
debug: true
}
client.subscribe ['socket_message']
client.channel('stream').on 'event:frame', (socketId, data) ->
client.channel('mirror').trigger 'frame', {message: 'Sending frame', dataUrl: data.dataUrl}
client.connect()
Jump to Line
Something went wrong with that request. Please try again.