1.6.0 • Published 8 months ago

signal-server.io v1.6.0

Weekly downloads
-
License
MIT
Repository
-
Last release
8 months ago

WebRTC Signaling Server Library

A lightweight signaling server and client library for WebRTC applications, featuring message retries and acknowledgments.

Features

  • Simple WebSocket-based signaling
  • Message acknowledgment and retries for reliability
  • Easily customizable for your WebRTC needs

Installation

Using NPM

npm install signal-server.io

Usage

Server

Start the signaling server by importing the SignalingServer class.

const SignalingServer = require('./src/server');

const server = new SignalingServer(8080);

Client

Use the SignalingClient class to connect to the signaling server.

const SignalingClient = require('./src/client');

const client = new SignalingClient('ws://localhost:8080');

// Handle incoming signals
client.onSignal = (senderId, payload) => {
  console.log(`Received signal from ${senderId}:`, payload);
};

// Send a signal
client.sendSignal('target-client-id', { type: 'offer', sdp: '...' });

Configuration

Server Options

port: Port number for the signaling server (default: 8080).

Client Options

retryInterval: Time in milliseconds between retries (default: 1000). maxRetries: Maximum retry attempts for each message (default: 5).

1.6.0

8 months ago