The authenticated user (their own conversations only)
onMessage / onError callbacks
OptionalonError?: (error: Error) => voidOptionalonMessage?: (message: ChatStreamMessage) => voidOptionalonReconnect?: () => voidThe stream came back after a drop, confirmed by the server. This stream replays nothing on connect, so anything sent while it was down never arrives — refetch conversations here or the unread badge stays wrong.
Subscribe to the current user's GLOBAL chat stream — new messages across ALL of their conversations — for notification badges and toasts.
handlers.onMessagefires for each arrival (each carriesroomName); the stream excludes the user's own messages and reconnects automatically.Unlike useUserChat (which streams one active conversation), this opens a single always-on stream regardless of which conversation, if any, is open — so it works while the user is anywhere in the app. No-op when
userIdis falsy or no cloud client is configured.Handlers are read through a ref, so passing new closures each render does NOT reconnect the stream; only a change of
userIddoes.