[][src]Crate embedded_websocket

Embedded Websocket

embedded_websocket facilitates the encoding and decoding of websocket frames and can be used for both clients and servers. The library is intended to be used in constrained memory environments like embedded microcontrollers which cannot reference the rust standard library. It will work with arbitrarily small buffers regardless of websocket frame size as long as the websocket header can be read (2 - 14 bytes depending on the payload size and masking).

Since the library is essentially an encoder or decoder of byte slices, the developer is free to use whatever transport mechanism they chose. The examples in the source repository use the TcpStream from the standard library.

Structs

HttpHeader

An http header struct that exposes websocket details

WebSocket

Websocket client and server implementation

WebSocketContext

Websocket details extracted from the http header

WebSocketOptions

Websocket options used by a websocket client to initiate an opening handshake with a websocket server

WebSocketReadResult

The metadata result of a read function call of a websocket

Enums

Error

Websocket specific errors

WebSocketCloseStatusCode

Websocket close status code as per the rfc6455 websocket spec

WebSocketReceiveMessageType

Websocket receive message type use when reading a websocket frame

WebSocketSendMessageType

Websocket send message type used when sending a websocket frame

WebSocketState

The state of the websocket

Functions

read_http_header

Reads a buffer and extracts the HttpHeader information from it, including websocket specific information.

Type Definitions

Result

Result returning a websocket specific error if encountered

WebSocketKey

A fixed length 24-character string used to hold a websocket key for the opening handshake

WebSocketServer

Used to return a sized type from WebSocket::new_server()

WebSocketSubProtocol

A maximum sized 24-character string used to store a sub protocol (e.g. chat)