Skip to content

Signalling server + client for creating P2P data connections

Notifications You must be signed in to change notification settings

seleb/web-rtc-mesh

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

npm run start

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

example

<script src="https://<server_url>/client.js"></script>
<script>
	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
</script>

About

Signalling server + client for creating P2P data connections

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published