Authors: Jeremy Ong, Michael Coles.
Purely functional aspects of websocket client comms.
Herein live all the functions for pure data processing.| create_auth_header/3 | |
| create_handshake/2 | |
| decode_frame/2 | Start or continue continuation payload with length less than 126 bytes. |
| decode_frame/5 | Length known and still missing data. |
| encode_frame/1 | Encodes the data with a header (including a masking key) and masks the data. |
| generate_ws_key/0 | Key sent in initial handshake. |
| mask_payload/2 | The payload is masked using a masking key byte by byte. |
| validate_handshake/2 | Validate handshake response challenge. |
create_auth_header(Type::basic, User::binary(), Pass::binary()) -> {binary(), binary()}
create_handshake(WSReq::websocket_req:req(), ExtraHeaders::[{string(), string()}]) -> iolist()
decode_frame(WSReq, Frame) -> any()
Start or continue continuation payload with length less than 126 bytes
decode_frame(WSReq::websocket_req:req(), Opcode::websocket_req:opcode(), Len::non_neg_integer(), Data::binary(), Buffer::binary()) -> {recv, websocket_req:req(), IncompleteFrame::binary()} | {frame, {OpcodeName::atom(), Payload::binary()}, websocket_req:req(), Rest::binary()} | {close, Reason::term(), websocket_req:req()}
Length known and still missing data
encode_frame(Type::websocket_req:frame()) -> binary()
Encodes the data with a header (including a masking key) and masks the data
generate_ws_key() -> binary()
Key sent in initial handshake
mask_payload(MaskingKey, Payload) -> any()
The payload is masked using a masking key byte by byte. Can do it in 4 byte chunks to save time until there is left than 4 bytes left
validate_handshake(HandshakeResponse::binary(), Key::binary()) -> {ok, binary()} | {notfound, binary()} | {error, term()}
Validate handshake response challenge
Generated by EDoc