get-write-payload-length ( bytes -- length-byte length-bytes/f )


Vocabulary
http.websockets

Inputs
bytesan object


Outputs
length-bytean object
length-bytes/fan object


Definition


: get-write-payload-length
( bytes -- length-byte length-bytes/f )
length {
{ [ dup 125 <= ] [ f ] }
{ [ dup 65535 <= ] [ [ drop 126 ] [ 2 >be ] bi ] }
[ [ drop 127 ] [ 8 >be ] bi ]
} cond ;