Skip to main content

Crate rift_web_chat

Crate rift_web_chat 

Source
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.