Skip to main content
protected onAttach(_att): void | Promise<void>
Hook: a connection has been authorized and is about to be admitted. Runs after authorize resolved the connection’s claims and before anything is sent to it. Inspect att.claims (and att.req, the upgrade request carrying front-door identity headers) and call att.close(code?, reason?) (or throw) to veto: a vetoed socket is closed, receives no frames, and is never counted in attachments. The default implementation admits every authorized connection. Parameters Returns void | Promise<void>

Attachment

One authorized client connection, as handed to Agent.onAttach (and to the socket server’s onAttach hook) right before the connection is admitted. Inspect claims and call close to veto the connection: a vetoed socket is closed immediately, never admitted as a watcher, and receives no protocol frames. Properties claims
readonly claims: ReadonlySet<Claim>
The claims this connection was granted by the authorization policy.
req?
readonly optional req?: Request
The connection’s upgrade request, when the host provided one. Identity headers stamped by an authenticating front door ride here, so a veto can consider the caller’s identity as well as its claims. Methods close()
close(code?, reason?): void
Veto this connection: close the socket now. It is never admitted and receives no frames. Parameters Returns void