FluxyChat

Rooms

Room status

Attach lifecycle. suspended still retries. failed stops.

room.status() (and room.status.current()) is the attach label. onStatusChange / status.subscribe emit { current, previous, retryIn, error }.

LabelMeans
initializedObject exists. Socket idle
attachingHandshake in progress
attachedLive on WebSocket
suspendedLong outage. Client still retries (retryIn)
failedAuth or max attempts. Call attach() again after you fix the token
detachedYou called detach(), or the socket is down without a retry
const room = client.room("lobby");

if (room.status() === "attached") {
  await room.messages.send("hello");
}

room.onStatusChange((change) => {
  console.log(change.previous, "->", change.current, change.retryIn);
});

await room.attach(); // waits until attached; rejects on suspended or failed

String(room.status) is the same label. Strict room.status === "attached" is false because status is also the subscribe handle. Use room.status().

Client-wide socket state is client.connection (ping(), whenState). Per-room attach status and client connection are not the same object. See Connection state.

room.error is the last attach error, or null.

React: useRoomStatus() inside FluxyRoomProvider.