Expand description
WebAssembly browser chat client for Rift over WebSocket relay.
This crate provides a simple API for text-only chat in the browser, using encrypted Rift protocol frames over a WebSocket relay.
§Example (JavaScript)
import init, { WebChat, create_invite } from 'rift-web-chat';
await init();
const invite = create_invite("my-room", null);
const chat = new WebChat("ws://localhost:8787/ws", invite);
chat.on_message((msg) => {
console.log(`${msg.from}: ${msg.text}`);
});
chat.on_connect(() => {
chat.send("Hello, world!");
});Structs§
- WebChat
- WebSocket-based chat client for the browser.
Functions§
- create_
invite - Create a new invite URL for a chat room.
- generate_
peer_ id - Generate a new random identity and return the peer ID (hex-encoded).
- inspect_
invite - Inspect an invite URL without joining.