Skip to content

roomrtc/signaling

Repository files navigation

signaling

A simple signaling server for RoomRTC

npm version Travis

npm install signaling

Then:

const signaling = require('signaling');

Use with express

const express = require('express');
const signaling = require('signaling');

const app = express();
const server = app.listen(port);
const signalingServer = signaling(server);

Class: Signaling

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.

Event: 'connected'

Added in: v0.10.0

signalingServer.on('connection', (client) => {
    console.log('New connection is connected: ', client.id);
});

Event: 'leave'

Added in: v0.10.0

signalingServer.on('leave', (client, roomCount) => {
    console.log('A connection has gone: ', client.id, roomCount);
});

Event: 'message'

Added in: v0.10.0

signalingServer.on('message', (client, msg) => {
    console.log('server receive message:', msg, client.id);
});

Event: 'signalingReady'

Added in: v1.1.0

signalingServer.on('signalingReady', (httpServer) => {
    console.log('signaling server is ready');
});

About

A simple signaling server for RoomRTC

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published