~/bend-docscommunity

src/ws.bend checks

raw source on the hub · import bend-kube-runtime@0.12.0.0/src/ws.bend as Ws

1 import
import Base

Types

type Frame source · line 11 · raw

Data

type WSt source · line 21 · raw

Data

Where the decoder is. WHead: before a frame's first byte WLen: before the byte with the mask bit and the 7-bit length WExt: need more bytes of a 16- or 64-bit length WKey: need more bytes of the masking key WPay: left bytes of payload to go, key rotated to the next byte WBad: a frame the decoder refuses; it stays here

type Stepped source · line 29 · raw

Data

type Fed source · line 32 · raw

Data

Definitions

def Ws.text source · line 36 · raw

U32

Opcodes.

def Ws.binary source · line 39 · raw

U32

def Ws.close source · line 42 · raw

U32

def Ws.ping source · line 45 · raw

U32

def Ws.pong source · line 48 · raw

U32

def Ws.max source · line 52 · raw

U32

The largest payload the decoder accepts.

def Ws.byte source · line 59 · raw

@+x:U32 -> @n:Nat -> U32

The nth byte of x, counting from the low end.

def Ws.len.go source · line 62 · raw

@+n:U32 -> @small:Bool -> @mid:Bool -> List<&2, U32>

def Ws.len source · line 75 · raw

@+n:U32 -> List<&2, U32>

The header from the second byte on: the mask bit (always set, as a client must) and the length, in 7, 16 or 64 bits.

def Ws.mask source · line 79 · raw

@bs:List<&2, U32> -> @+a:U32 -> @+b:U32 -> @+c:U32 -> @+d:U32 -> List<&2, U32>

XORs bytes with the key a, b, c, d, rotating.

def Ws.frame source · line 87 · raw

@+op:U32 -> @+data:List<&2, U32> -> @+key:U32 -> List<&2, U32>

One final frame of op carrying data, masked with key.

def Ws.unmask source · line 96 · raw

@key:List<&2, U32> -> @+b:U32 -> U32

def Ws.rotate source · line 103 · raw

@key:List<&2, U32> -> List<&2, U32>

def Ws.payload source · line 110 · raw

@+fin:Bool -> @+op:U32 -> @+len:U32 -> @key:List<&2, U32> -> @empty:Bool -> Stepped

def Ws.begin.go source · line 117 · raw

@+fin:Bool -> @+op:U32 -> @+len:U32 -> @big:Bool -> @masked:Bool -> Stepped

def Ws.begin source · line 127 · raw

@+fin:Bool -> @+op:U32 -> @masked:Bool -> @+len:U32 -> Stepped

The header is whole: the key follows if masked, then the payload.

def Ws.len7 source · line 130 · raw

@+fin:Bool -> @+op:U32 -> @masked:Bool -> @+n:U32 -> @two:Bool -> @eight:Bool -> Stepped

def Ws.ext source · line 139 · raw

@+fin:Bool -> @+op:U32 -> @masked:Bool -> @+need:U32 -> @+len:U32 -> @last:Bool -> Stepped

def Ws.key source · line 146 · raw

@+fin:Bool -> @+op:U32 -> @+len:U32 -> @+need:U32 -> @+key:List<&2, U32> -> @last:Bool -> Stepped

def Ws.pay source · line 153 · raw

@+fin:Bool -> @+op:U32 -> @+left:U32 -> @key:List<&2, U32> -> @+acc:List<&2, U32> -> @last:Bool -> Stepped

def Ws.step source · line 162 · raw

@st:WSt -> @+b:U32 -> Stepped

One byte into the decoder.

def Ws.add source · line 180 · raw

@got:Maybe<&2, Frame> -> @out:List<&2, Frame> -> List<&2, Frame>

def Ws.feed.go source · line 187 · raw

@bs:List<&2, U32> -> @ev:Stepped -> @out:List<&2, Frame> -> Fed

def Ws.feed source · line 195 · raw

@st:WSt -> @bs:List<&2, U32> -> Fed

Feeds bytes to the decoder: its next state and the frames they finished.

def Ws.error source · line 198 · raw

@st:WSt -> Maybe<&2, String>