def raw

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

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
import bend-kit-crypto@0.2.2.1/crypto.bend as Crypto

955# A client masks every frame with a fresh key from the OS secure random source (§5.3).
956def raw(server: Bool, sock: Socket, +tls: Bool, +fin: Bool, +op: U32, payload: Bytes.Bytes) -> IO(Socket & Result<&1, &1, U32 & String, Unit>):
957  match server:
958    case True{}:
959      raw.encoded(encode(Frame{fin, op, payload}, None{}), sock, tls)
960    case False{}:
961      do IO<Socket & Result<&1, &1, U32 & String, Unit>>:
962        k : Result<&1, &1, U32 & String, U32 & Array<U32>> <- Crypto.random.words(4)
963        raw.keyed(k, sock, tls, fin, op, payload)

Uses (17)

Used by (5)