Skip to main content
protected onConnect(_conn): Promise<void>
Hook: a client connection is established. Override to authorize, seed, or close the connection. The default implementation does nothing. When the connection surface is active (an authorize / onAttach / webSocket override) and this hook is overridden, the default webSocket runs it once per new connection — before authorization or any snapshot — with a context carrying the upgrade request (req) and a close to reject the connection. Frames a fast client sends while this gate is pending are buffered and replayed in order once the connection is admitted. Overriding this hook alone does NOT activate the connection surface. For claims-based decisions prefer authorize and onAttach, which run with the connection’s resolved claims. Parameters Returns Promise<void>