Skip to content

classifyCloseCode

classifyCloseCode(code, canResume): CloseAction

Defined in: packages/ws/src/reconnect.ts:57

Classifies a close code.

Any code outside the two tables above is reconnectable: transport-level closes (1006), server restarts (1001), Discord’s own 4000, and the 1000 the Gateway itself sends after a non-resumable op 9 all belong here. Whether that reconnect resumes or identifies is not a property of the code — it is whether a session survives, which is why canResume is a parameter rather than something this module works out for itself.

number

WebSocket close code.

boolean

Whether the session can still be resumed.

CloseAction