Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/seleb/web-rtc-mesh
- Owner: seleb
- Created: 2018-04-15T20:24:23.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2024-10-31T02:32:58.000Z (3 months ago)
- Last Synced: 2024-10-31T03:24:20.383Z (3 months ago)
- Topics: javascript, nodejs, webrtc
- Language: JavaScript
- Size: 732 KB
- Stars: 5
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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 aliveYou 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```