def close.parse

bend-kit-websocket@0.4.0.0 · websocket.bend:751

import bend-kit-websocket@0.4.0.0/websocket.bend as Websocket
import Base
import bend-kit-bytes@0.3.3.0/bytes.bend as Bytes

751# The code and reason of a close frame. An empty payload is 1005 (no status).
752def close.parse(p: Bytes.Bytes) -> Result<&1, &1, U32 & String, U32 & Bytes.Bytes>:
753  Bytes.Bytes{+n, buf} = p
754  match n:
755    case 0:
756      Done{(1005, Bytes.Bytes{0, buf})}
757    case +m:
758      close.code(Bytes.get.u16be(Bytes.Bytes{m, buf}, 0))

Uses (11)

Used by (1)