Skip to main content
Version: 57.2.0

SocketDataBag

Per-socket data bag. fullUser is populated once at handshake (see loadFullUserForSocket / RealtimeApp's connection handler) by loading the full Mongoose user document for decodedToken.id, and refreshed by D1's periodic re-validation sweep. When present it is authoritative for authorization (permits fields like organizationIds that the synthetic decoded-token shape never carries — see D2); the synthetic shape remains a fallback for setups with no userModel configured, or while the handshake load is still in flight.

Properties

fullUser?

optional fullUser?: any


fullUserLoad?

optional fullUserLoad?: Promise<void>

The in-flight handshake load of SocketDataBag.fullUser, published so handlers that must not authorize against the synthetic token user can await it (see awaitSocketFullUser). Never rejects.


syncSubscriptions?

optional syncSubscriptions?: Map<string, Set<string>>

Sync collection tag -> joined sync:{stream} rooms (see socketHandlers.ts). Lives on the data bag (not the handler closure) so D1's sweep can re-resolve stream membership and socket.leave() rooms no longer held (D4) without needing access to installSyncSocketHandlers's internal state.