peer-cdn

peer-cdn

  • Docs
  • Help
  • GitHub

›Server

Quick Start

  • Installation
  • Service Worker
  • Browser Client

Plugins

  • Peer Plugin
  • Network Plugin
  • Delegate Plugin

Router

  • Router
  • Middleware
  • Strategies

Server

  • Server

Example

  • Example

Server

To make peer-cdn work you need signaling server.

What is signaling?

Signaling is the process of coordinating communication. In order for a WebRTC application to set up a 'call', its clients need to exchange information:

  • Session control messages used to open or close communication.
  • Error messages.
  • Media metadata such as codecs and codec settings, bandwidth and media types.
  • Key data, used to establish secure connections.
  • Network data, such as a host's IP address and port as seen by the outside world.

This signaling process needs a way for clients to pass messages back and forth. That mechanism is not implemented by the WebRTC APIs: we need to build it yourself.

Setting up singling server

There is an easy setup, simply import server from peer-cdn package and use it with your node API.

const http = require("http");
const express = require("express");
const PeerCdnServer = require("peer-cdn/server");

const app = express();

// setup your API...

const server = http.createServer(app);

// Setup peer-cdn signaling server
const appendPeerCdnServer = PeerCdnServer.default || PeerCdnServer;
appendPeerCdnServer(server);

server.listen(port, () => {
  // eslint-disable-next-line no-console
  console.log(`Server started at port ${port}`);
});

← StrategiesExample →
  • What is signaling?
  • Setting up singling server
peer-cdn
Docs
Documentation
Community
Support
More
rafallorenz.comGitHubStar
Copyright © 2022 Rafał Lorenz