TLSocketRoomOptions
Table of contents
Base options for TLSocketRoom.
interface TLSocketRoomOptions<R extends UnknownRecord, SessionMeta> {}Properties
clientTimeout
optional
clientTimeout?: number;initialSnapshot
optional
Deprecated: use the storage option instead
initialSnapshot?: RoomSnapshot | TLStoreSnapshot;log
optional
log?: TLSyncLog;onAfterReceiveMessage
optional
onAfterReceiveMessage?: (args: {
message: TLSocketServerSentEvent<R>;
meta: SessionMeta;
sessionId: string;
stringified: string;
}) => void;onBeforeSendMessage
optional
onBeforeSendMessage?: (args: {
message: TLSocketServerSentEvent<R>;
meta: SessionMeta;
sessionId: string;
stringified: string;
}) => void;onSessionRemoved
optional
onSessionRemoved?: (
room: TLSocketRoom<R, SessionMeta>,
args: {
meta: SessionMeta;
numSessionsRemaining: number;
sessionId: string;
},
) => void;onSessionSnapshot
optional
When set, the room will call TLSocketRoom.getSessionSnapshot after no message activity for a session for 5s and pass the result to this callback. Use for persisting snapshots to WebSocket attachments (e.g. Cloudflare hibernation). The room clears any pending snapshot when the session closes.
onSessionSnapshot?: (
sessionId: string,
snapshot: SessionStateSnapshot,
) => void;schema
optional
schema?: StoreSchema<R, any>;storage
optional
storage?: TLSyncStorage<R>;Methods
onDataChange
optional
Deprecated: use the storage option with an onChange callback instead
Prev
TLPersistentClientSocketNext
TLSyncForwardDiff