Skip to content
Roomful is in public beta — install with the @beta tag. Share feedback →

Quickstart

Audience: users.

This walkthrough shows the intended first integration flow for Roomful.

Terminal window
npm install @roomful/core@beta
import { createRoom } from '@roomful/core';
const room = createRoom('my-first-room', {
transport: 'auto',
presence: {
name: 'Alice',
color: '#4F46E5',
},
});
await room.connect();

Transport support in the current baseline:

  • Available: auto, broadcast, webrtc, websocket
  • auto order: broadcast -> webrtc -> websocket -> in-memory

WebRTC cross-machine baseline:

const room = createRoom('my-first-room', {
transport: 'webrtc',
relayUrl: 'ws://localhost:8787',
presence: { name: 'Alice', color: '#4F46E5' },
});

WebSocket relay baseline:

const room = createRoom('my-first-room', {
transport: 'websocket',
relayUrl: 'ws://localhost:8787',
presence: { name: 'Alice', color: '#4F46E5' },
});
const presence = room.usePresence();
const unsubscribe = presence.subscribe((peers) => {
console.log(`Peers online: ${peers.length}`);
});
const board = document.getElementById('board');
const cursors = room.useCursors();
if (board) {
cursors.mount(board);
cursors.render({
container: board,
style: 'default',
showName: true,
});
}
window.addEventListener('beforeunload', () => {
unsubscribe();
void room.disconnect();
});
import { RoomfulProvider, usePresence } from '@roomful/react';
function App() {
return (
<RoomfulProvider roomId="my-first-room" presence={{ name: 'Alice', color: '#4F46E5' }}>
<RoomPanel />
</RoomfulProvider>
);
}
function RoomPanel() {
const { others } = usePresence();
return <p>{others.length} peers in room</p>;
}
  • Add shared state with room.useState(...)
  • Add awareness (typing/focus/selection) with room.useAwareness()
  • Add event broadcasting with room.useEvents()