A simple signaling server for RoomRTC
npm install signaling
Then:
const signaling = require('signaling');
const express = require('express');
const signaling = require('signaling');
const app = express();
const server = app.listen(port);
const signalingServer = signaling(server);
Added in: v0.10.0
The Signaling
class is defined and exposed by the signaling
module:
const Signaling = require('signaling').Signaling;
const signalingServer = new Signaling([httpServer, options]);
An event connection
is going to emit when new client is connected and event leave
when the connection has gone.
Added in: v0.10.0
signalingServer.on('connection', (client) => {
console.log('New connection is connected: ', client.id);
});
Added in: v0.10.0
signalingServer.on('leave', (client, roomCount) => {
console.log('A connection has gone: ', client.id, roomCount);
});
Added in: v0.10.0
signalingServer.on('message', (client, msg) => {
console.log('server receive message:', msg, client.id);
});
Added in: v1.1.0
signalingServer.on('signalingReady', (httpServer) => {
console.log('signaling server is ready');
});