JoinyJS simplifies WebRTC API and allows you to communicate with multiple peers transparently.
import { createWebRTC } from 'joiny';
// get a WebRTC object
const webRTC = createWebRTC({
media: { video: true, audio: true }
channels: [
{ chat: { reliable: false } },
{ file: { reliable: true } }
]
});
// get a local peer with a callback
webRTC.on('local', (peer) => { ... });
// get a remote peer with a callback
webRTC.on('remote', (peer) => { ... });
// get a chat channel bundle with a callback
webRTC.on('chat.channel', (channel) => { ... });
// get a file channel bundle with a callback
webRTC.on('file.channel', (channel) => { ... });
// start communication
webRTC.start();
$ cd examples/chat
$ npm install
$ npm start
Access http://localhost:3000
with some browsers.
Push the "Connect" Button on each browser.
$ npm install
$ npm run build
The MIT License