chickadee » ws-client » reason->close-code

reason->close-code SYMBOLprocedure
close-code->reason INTEGERprocedure

Maps between reasons for closing a connection and the corresponding close codes:

code (integer)code (u8vector)reason
1000#u8(3 232)'normal-closure
1001#u8(3 233)'going-away
1002#u8(3 234)'protocol-error
1003#u8(3 235)'unsupported-data
1005#u8(3 237)'no-status-rcvd
1006#u8(3 238)'abnormal-closure
1007#u8(3 239)'invalid-frame-payload-data
1008#u8(3 240)'policy-violation
1009#u8(3 241)'message-too-big
1010#u8(3 242)'mandatory-ext
1011#u8(3 243)'internal-server-error
1015#u8(3 247)'tls-handshake

The procedure reason->close-code returns the close code as a u8vector rather than an integer; this is so that the value can be included into a frame payload without conversion.

Signals a composite condition of kind 'websocket 'exn if an unrecognised close code or reason is supplied. The application is expected to redefine this procedure if it wishes to make use of reserved close codes. Note that not all of the close codes listed here are expected to occur in a connection close frame.