Use WebRTC RTCDataChannel in server/client programming pattern, removing the need for an extra signaling server.
Features
- End-to-end encryption provided by RTCDataChannel.
- Easy to use server/client programming interfaces for using WebRTC RTCDataChannel, encapsulating the details of how WebRTC peer connections function internally.
- Data port multiplexing: all rtc data channel from different clients are multiplexed in one data port.
cd server
npm install
- create configuration
/server/.env
file from/server/.envexample
file. npm run build
npm run demo-echo
Console should output message (or similar):
info: UDP proxy: server listening 0.0.0.0:60123
info: Listening for HTTP requests on port 3000
- cd
client
npm install
npm run build
- copy
dist/webrtc-direct.min.js
intoclient/demo
folder. - serve
client/demo/echo.html
via HTTP - open
demo.html
via HTTP protocol and pressconnect
- enter message in input near "Send" button.
- press "Send"
- inspect received
Echo: <your message>
Note: npm install
and npm run build
to generate dist
folder to use client as a library.