Romzo

Romzo is an open-source WebSocket relay framework that forwards messages within rooms.

Romzo 是一个按房间转发消息的开源 WebSocket 中继框架。

Quick start

快速开始

This example creates a room on the public test relay, builds an invite link and subscribes to a channel. Guests join with joinRoom.

示例使用公共测试节点创建房间、生成邀请链接并订阅频道。访客通过 joinRoom 加入。

TS
import {
  createRoom, buildInviteLink, RelaySession
} from 'romzo';

const room = await createRoom('romzo.net', {
  app: 'example',
  channels: [{ name: 'table', maxFrameBytes: 262144 }]
});

const invite = buildInviteLink(room.descriptor.origin,
  room.descriptor.code, 'https://client.example.com/');
// -> https://client.example.com/#ABCD123XYZ/romzo.net
const url = room.descriptor.origin.replace(/^http/, 'ws') + '/ws';

const session = await RelaySession.connect(
  url, room.admission, room.transport);

await session.subscribe('table');

应用场景

Use case

联机对战:房间即一局,玩家操作经频道转发,规则与状态同步由客户端处理。

Online matches: A room is one match. Player actions flow over channels; clients handle rules and state.