Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/seleb/web-rtc-mesh

Signalling server + client for creating P2P data connections
https://github.com/seleb/web-rtc-mesh

javascript nodejs webrtc

Last synced: 3 months ago
JSON representation

Signalling server + client for creating P2P data connections

Awesome Lists containing this project

README

        

# web-rtc-mesh

Signalling server + client for creating P2P data connections

## setup

Environment variables:

- `PORT`: server port to use
- `NUMB_USERNAME`/`NUMB_CREDENTIAL`: username/password for a `turn:numb.viagenie.ca` account (if there aren't both defined, only the public stun servers will be used)
- `NODE_ENV`: `"production"` or `"development"`; passed to webpack
- `PINGPONG`: delay in milliseconds between pings for the sake of keeping connections alive

You can also edit `./src/config.js`.

## use

```sh
npm run start
```

This will builds the client to `./dist/client.js` and start the signalling server.

## example

```js

const client = new window.Client.default({
host: "wss://<server_url>",
room: "myRoom",
});
client.on(window.Client.DATA, ({ from, data }) => {
console.log("received",data,"from",from);
});
client.broadcast({
key: "value"
}); // send a data channel message to all connected vertices

```