socket.io-peer-server
v1.2.0
Published
Server middleware to power socket.io-peer. Handles signalling.
Downloads
1
Readme
Socket.io-peer-server
The socket.io middleware that powers socket.io-peer. It handles passing signalling data between all peers. Just include the middleware and everything is handled for you.
How to use
Simple require the module and use it.
var peerserver = require('socket.io-peer-server').Server
var io = require('socket.io')(server);
io.use(peerserver)
For example, in an express powered app, you can do the following:
var app = require('express')()
var server = require('http').Server(app)
var peerserver = require('socket.io-peer-server').Server
var io = require('socket.io')(server)
app.use(express.static(__dirname))
io.use(peerserver)
server.listen(3030, function () {
console.log("Listening on 3030")
})
It can also be used inside your connection logic so that you can specify a room that clients will communicate over:
peerserver(socket, null, room)
Note that null
must be passed as the second arguement when being used in this context.