MCPcopy Create free account
hub / github.com/tiann/hapi / toClientCloseCode

Function toClientCloseCode

hub/src/web/server.ts:39–43  ·  view source on GitHub ↗
(code: number)

Source from the content-addressed store, hash-verified

37// Codes 1005/1006/1015 are reserved and cannot be sent in a close frame;
38// abnormal upstream drops commonly produce 1006, which would throw on clientWs.close().
39function toClientCloseCode(code: number): number {
40 return code >= 1000 && code <= 4999 && code !== 1005 && code !== 1006 && code !== 1015
41 ? code
42 : 1011
43}
44
45function decodeWsText(message: string | ArrayBuffer | Uint8Array): string {
46 if (typeof message === 'string') return message

Callers 2

openFunction · 0.70
closeFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected