High level real-time and presence API on top of webxdc.joinRealtimeChannel().
🟢 easily discover who is online, no need to implement presence on your own.
🔄 easy sync/advertising of user's state with peers.
💫 send and receive objects around similar to the webxdc.sendUpdate()
API without having to worry to convert from/to Uint8Array
📦 send big payloads of MBs without worrying to split in chunks of 128KB
npm install @webxdc/realtime
Quick overview of the API:
import { RealTime } from "@webxdc/realtime"; const realtime = new RealTime({ onPeersChanged: (peers) => console.log(peers), onPayload: (peerId, payload) => console.log(peerId, payload), }); // optional: set a state to be advertised to peers realtime.setState({ status: "I am available!" }); // go online realtime.connect(); // payload can be any object you want realtime.sendPayload({ name: "foo", text: "hi!" });
Remember to include the webxdc.js
file in your index.html
:
<!doctype html> <html> <head> <meta charset="utf-8" /> <script src="webxdc.js"></script> </head> <body> <script type="module" src="./main.js"></script> </body> </html>
For a full example check the ./src/main.ts file.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4