PeerJS: Simple peer-to-peer with WebRTC ESNext
PeerJS provides a complete, configurable, and easy-to-use peer-to-peer API built on top of WebRTC.
Warning
This fork only supports data connections and json serialization.
Setup
Include the library
with npm:
npm install peerjs
and the usage:
;
Create a Peer
const peer = 'pick-an-id'; // You can pick your own id or omit the id if you want to get a random one from the server.
Data connections
Connect
const conn = peer;conn;
Receive
peer;
Running tests
npm test
FAQ
Q. I have a message Critical dependency: the request of a dependency is an expression
in browser's console
A. The message occurs when you use PeerJS with Webpack. It is not critical! It relates to Parcel https://github.com/parcel-bundler/parcel/issues/2883 We'll resolve it when updated to Parcel V2.
Links
Documentation / API Reference
PeerServer
Discuss PeerJS on our Telegram Channel
Changelog
License
PeerJS is licensed under the MIT License.