Coder Social home page Coder Social logo

websocket-signal-webrtc's Introduction

WebSocket Signaling Server for WebRTC

A simple web socket server to allow for signaling across the web for webRTC clients.

I won't take credit for the main server code. It is mostly following the examples of the web socket node module and a basic static http service.

Following items are specific to my implementation:

  • Lots of comments to explain whats going on.
  • JSON data exchange format with 4 events:
  1. Direct: Used to send data to a specific peer (needed for sdp and candidate exchange)
  2. Broadcast: Used to send data to all peers
  3. Handshake: To update the PID in the server connection (the server will request a handshake upon connection to make sure the pid is saved before sharing it with others)
  4. peerList: A manual way to check who else is connected (mainly for debug not currently used in index.html)
  • A simple static website for debug of connections, which some data outputs and an example of how to establish a mesh via webRTC. This can be the flatbed for all sorts of distributed applications, like private chats, video/audio conferences et. al.

Security and Status

I have not added any special security to this. According to webRTC Signaling Servers don't have to be encrypted, as offer/answer exchange ensures no MITM attacks can occur over the server.

Once DataChannels are established, the webRTC connections are direct between peers and webRTC DTLS encrypts data between the peers. More could be done on the client side to encrypt before sending data across, such as a PubKey encryption system etc, but I will leave that to the developer to come up with.

I am currently testing this for production. Roadmap 2021:

Usage

Start as service using pm2 using any configuration in signal-server.config.js

pm2 start signal-server.config.js

websocket-signal-webrtc's People

Contributors

dletta avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.