WebSocket API (client and server) More...
Go to the source code of this file.
Data Structures | |
struct | WebSocketAuthContext |
Authentication context. More... | |
struct | WebSocketHandshakeContext |
Handshake context. More... | |
struct | WebSocketFrameContext |
Frame encoding/decoding context. More... | |
struct | WebSocketUtf8Context |
UTF-8 decoding context. More... | |
struct | _WebSocket |
Structure describing a WebSocket. More... | |
Macros | |
#define | WEB_SOCKET_SUPPORT DISABLED |
#define | WEB_SOCKET_MAX_COUNT 4 |
#define | WEB_SOCKET_TLS_SUPPORT DISABLED |
#define | WEB_SOCKET_BASIC_AUTH_SUPPORT DISABLED |
#define | WEB_SOCKET_DIGEST_AUTH_SUPPORT DISABLED |
#define | WEB_SOCKET_MAX_CONN_RETRIES 3 |
#define | WEB_SOCKET_BUFFER_SIZE 1024 |
#define | WEB_SOCKET_HOST_MAX_LEN 32 |
#define | WEB_SOCKET_ORIGIN_MAX_LEN 16 |
#define | WEB_SOCKET_SUB_PROTOCOL_MAX_LEN 8 |
#define | WEB_SOCKET_URI_MAX_LEN 32 |
#define | WEB_SOCKET_QUERY_STRING_MAX_LEN 32 |
#define | WEB_SOCKET_REALM_MAX_LEN 32 |
#define | WEB_SOCKET_USERNAME_MAX_LEN 16 |
#define | WEB_SOCKET_PASSWORD_MAX_LEN 16 |
#define | WEB_SOCKET_NONCE_MAX_LEN 32 |
#define | WEB_SOCKET_OPAQUE_MAX_LEN 32 |
#define | WEB_SOCKET_CNONCE_SIZE 16 |
#define | WEB_SOCKET_CLIENT_KEY_SIZE 24 |
#define | WEB_SOCKET_SERVER_KEY_SIZE 28 |
#define | WebSocket struct _WebSocket |
Typedefs | |
struct { | |
char_t type | |
uint32_t dataStart | |
uint32_t dataLength | |
uint8_t nameLength | |
char_t name [] | |
uint8_t tokenLen: 4 | |
uint8_t type: 2 | |
uint8_t version: 2 | |
uint8_t code | |
uint16_t mid | |
uint8_t token [] | |
union { | |
uint8_t b [6] | |
uint16_t w [3] | |
} | |
uint16_t srcPort | |
uint16_t destPort | |
uint32_t seqNum | |
uint32_t ackNum | |
uint8_t reserved1: 4 | |
uint8_t dataOffset: 4 | |
uint8_t flags: 6 | |
uint8_t reserved2: 2 | |
uint16_t window | |
uint16_t checksum | |
uint16_t urgentPointer | |
uint8_t options [] | |
uint16_t length | |
uint8_t data [] | |
uint8_t op | |
uint8_t htype | |
uint8_t hlen | |
uint8_t hops | |
uint32_t xid | |
uint16_t secs | |
uint16_t flags | |
Ipv4Addr ciaddr | |
Ipv4Addr yiaddr | |
Ipv4Addr siaddr | |
Ipv4Addr giaddr | |
MacAddr chaddr | |
uint8_t unused [10] | |
uint8_t sname [64] | |
uint8_t file [128] | |
uint32_t magicCookie | |
uint16_t type | |
uint16_t hardwareType | |
uint32_t time | |
MacAddr linkLayerAddr | |
uint16_t id | |
uint8_t rd: 1 | |
uint8_t tc: 1 | |
uint8_t aa: 1 | |
uint8_t opcode: 4 | |
uint8_t qr: 1 | |
uint8_t rcode: 4 | |
uint8_t z: 3 | |
uint8_t ra: 1 | |
uint16_t qdcount | |
uint16_t ancount | |
uint16_t nscount | |
uint16_t arcount | |
uint8_t questions [] | |
uint16_t controlWord | |
uint16_t byteCount | |
uint8_t bLength | |
uint8_t bDescriptorType | |
uint16_t bcdUsb | |
uint8_t bDeviceClass | |
uint8_t bDeviceSubClass | |
uint8_t bDeviceProtocol | |
uint8_t bMaxPacketSize0 | |
uint16_t idVendor | |
uint16_t idProduct | |
uint16_t bcdDevice | |
uint8_t iManufacturer | |
uint8_t iProduct | |
uint8_t iSerialNumber | |
uint8_t bNumConfigurations | |
uint8_t maxRespTime | |
Ipv4Addr groupAddr | |
uint16_t hrd | |
uint16_t pro | |
uint8_t hln | |
uint8_t pln | |
uint16_t op | |
MacAddr sha | |
Ipv4Addr spa | |
MacAddr tha | |
Ipv4Addr tpa | |
uint8_t length | |
uint8_t value [] | |
uint16_t first | |
uint16_t last | |
uint16_t next | |
union { | |
uint8_t b [16] | |
uint16_t w [8] | |
uint32_t dw [4] | |
} | |
uint16_t maxRespDelay | |
uint16_t reserved | |
Ipv6Addr multicastAddr | |
uint32_t reserved | |
uint16_t pvid | |
uint8_t autoNegSupportStatus | |
uint16_t pmdAutoNegAdvCap | |
uint16_t operationalMauType | |
uint16_t capabilities | |
uint8_t deviceType | |
uint8_t lengthH: 1 | |
uint8_t lengthL | |
uint8_t t: 1 | |
uint8_t c: 1 | |
union { | |
int32_t integer | |
uint8_t octetString [1] | |
uint8_t oid [1] | |
uint8_t ipAddr [4] | |
uint32_t counter32 | |
uint32_t gauge32 | |
uint32_t unsigned32 | |
uint32_t timeTicks | |
uint64_t counter64 | |
} | |
uint16_t transactionId | |
uint16_t protocolId | |
uint8_t unitId | |
uint8_t pdu [] | |
uint8_t retain: 1 | |
uint8_t qos: 2 | |
uint8_t dup: 1 | |
union { | |
uint8_t all | |
struct { | |
uint8_t topicIdType: 2 | |
uint8_t cleanSession: 1 | |
uint8_t will: 1 | |
uint8_t retain: 1 | |
uint8_t qos: 2 | |
uint8_t dup: 1 | |
} | |
} | |
uint8_t b: 1 | |
uint8_t identifier | |
uint8_t valueSize | |
Ipv4Addr srcIpAddr | |
Ipv4Addr destIpAddr | |
Eui64 interfaceId | |
uint16_t mru | |
uint8_t peerIdLength | |
uint8_t peerId [] | |
uint32_t seconds | |
uint32_t fraction | |
uint16_t opcode | |
char_t filename [] | |
uint8_t reserved: 3 | |
uint8_t fin: 1 | |
uint8_t payloadLen: 7 | |
uint8_t mask: 1 | |
uint8_t extPayloadLen [] | |
uint32_t length | |
uint8_t payload [] | |
uint8_t protocolVersionId | |
uint8_t bpduType | |
StpBridgeId rootId | |
uint32_t rootPathCost | |
StpBridgeId bridgeId | |
uint16_t portId | |
uint16_t messageAge | |
uint16_t maxAge | |
uint16_t helloTime | |
uint16_t forwardDelay | |
uint8_t version1Length | |
uint16_t priority | |
MacAddr addr | |
} | WebSocketFrame |
WebSocket frame. More... | |
typedef error_t(* | WebSocketRandCallback) (uint8_t *data, size_t length) |
Random data generation callback function. More... | |
typedef error_t(* | WebSocketTlsInitCallback) (WebSocket *webSocket, TlsContext *tlsContext) |
TLS initialization callback function. More... | |
Functions | |
error_t | webSocketInit (void) |
WebSocket related initialization. More... | |
error_t | webSocketRegisterRandCallback (WebSocketRandCallback callback) |
Register RNG callback function. More... | |
WebSocket * | webSocketOpen (void) |
Create a WebSocket. More... | |
WebSocket * | webSocketUpgradeSocket (Socket *socket) |
Upgrade a socket to a WebSocket. More... | |
WebSocket * | webSocketUpgradeSecureSocket (Socket *socket, TlsContext *tlsContext) |
Upgrade a secure socket to a secure WebSocket. More... | |
error_t | webSocketRegisterTlsInitCallback (WebSocket *webSocket, WebSocketTlsInitCallback callback) |
Register TLS initialization callback function. More... | |
error_t | webSocketSetTimeout (WebSocket *webSocket, systime_t timeout) |
Set timeout value for blocking operations. More... | |
error_t | webSocketSetHost (WebSocket *webSocket, const char_t *host) |
Set the domain name of the server (for virtual hosting) More... | |
error_t | webSocketSetOrigin (WebSocket *webSocket, const char_t *origin) |
Set the origin header field. More... | |
error_t | webSocketSetSubProtocol (WebSocket *webSocket, const char_t *subProtocol) |
Set the sub-protocol header field. More... | |
error_t | webSocketSetAuthInfo (WebSocket *webSocket, const char_t *username, const char_t *password, uint_t allowedAuthModes) |
Set authentication information. More... | |
error_t | webSocketBindToInterface (WebSocket *webSocket, NetInterface *interface) |
Bind the WebSocket to a particular network interface. More... | |
error_t | webSocketConnect (WebSocket *webSocket, const IpAddr *serverIpAddr, uint16_t serverPort, const char_t *uri) |
Establish a WebSocket connection. More... | |
error_t | webSocketSetClientKey (WebSocket *webSocket, const char_t *clientKey) |
Set client's key. More... | |
error_t | webSocketParseClientHandshake (WebSocket *webSocket) |
Parse client's handshake. More... | |
error_t | webSocketSendServerHandshake (WebSocket *webSocket) |
Send server's handshake. More... | |
error_t | webSocketSendErrorResponse (WebSocket *webSocket, uint_t statusCode, const char_t *message) |
Send HTTP error response to the client. More... | |
error_t | webSocketSend (WebSocket *webSocket, const void *data, size_t length, WebSocketFrameType type, size_t *written) |
Transmit data over the WebSocket connection. More... | |
error_t | webSocketSendEx (WebSocket *webSocket, const void *data, size_t length, WebSocketFrameType type, size_t *written, bool_t firstFrag, bool_t lastFrag) |
Transmit data over the WebSocket connection. More... | |
error_t | webSocketReceive (WebSocket *webSocket, void *data, size_t size, WebSocketFrameType *type, size_t *received) |
Receive data from a WebSocket connection. More... | |
error_t | webSocketReceiveEx (WebSocket *webSocket, void *data, size_t size, WebSocketFrameType *type, size_t *received, bool_t *firstFrag, bool_t *lastFrag) |
Receive data from a WebSocket connection. More... | |
bool_t | webSocketIsRxReady (WebSocket *webSocket) |
Check whether some data is available in the receive buffer. More... | |
error_t | webSocketShutdown (WebSocket *webSocket) |
Gracefully close a WebSocket connection. More... | |
void | webSocketClose (WebSocket *webSocket) |
Close a WebSocket connection. More... | |
Variables | |
WebSocketRandCallback | webSockRandCallback |
Detailed Description
WebSocket API (client and server)
License
SPDX-License-Identifier: GPL-2.0-or-later
Copyright (C) 2010-2023 Oryx Embedded SARL. All rights reserved.
This file is part of CycloneTCP Open.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- Version
- 2.2.4
Definition in file web_socket.h.
Macro Definition Documentation
◆ WEB_SOCKET_BASIC_AUTH_SUPPORT
#define WEB_SOCKET_BASIC_AUTH_SUPPORT DISABLED |
Definition at line 61 of file web_socket.h.
◆ WEB_SOCKET_BUFFER_SIZE
#define WEB_SOCKET_BUFFER_SIZE 1024 |
Definition at line 82 of file web_socket.h.
◆ WEB_SOCKET_CLIENT_KEY_SIZE
#define WEB_SOCKET_CLIENT_KEY_SIZE 24 |
Definition at line 171 of file web_socket.h.
◆ WEB_SOCKET_CNONCE_SIZE
#define WEB_SOCKET_CNONCE_SIZE 16 |
Definition at line 159 of file web_socket.h.
◆ WEB_SOCKET_DIGEST_AUTH_SUPPORT
#define WEB_SOCKET_DIGEST_AUTH_SUPPORT DISABLED |
Definition at line 68 of file web_socket.h.
◆ WEB_SOCKET_HOST_MAX_LEN
#define WEB_SOCKET_HOST_MAX_LEN 32 |
Definition at line 89 of file web_socket.h.
◆ WEB_SOCKET_MAX_CONN_RETRIES
#define WEB_SOCKET_MAX_CONN_RETRIES 3 |
Definition at line 75 of file web_socket.h.
◆ WEB_SOCKET_MAX_COUNT
#define WEB_SOCKET_MAX_COUNT 4 |
Definition at line 47 of file web_socket.h.
◆ WEB_SOCKET_NONCE_MAX_LEN
#define WEB_SOCKET_NONCE_MAX_LEN 32 |
Definition at line 145 of file web_socket.h.
◆ WEB_SOCKET_OPAQUE_MAX_LEN
#define WEB_SOCKET_OPAQUE_MAX_LEN 32 |
Definition at line 152 of file web_socket.h.
◆ WEB_SOCKET_ORIGIN_MAX_LEN
#define WEB_SOCKET_ORIGIN_MAX_LEN 16 |
Definition at line 96 of file web_socket.h.
◆ WEB_SOCKET_PASSWORD_MAX_LEN
#define WEB_SOCKET_PASSWORD_MAX_LEN 16 |
Definition at line 138 of file web_socket.h.
◆ WEB_SOCKET_QUERY_STRING_MAX_LEN
#define WEB_SOCKET_QUERY_STRING_MAX_LEN 32 |
Definition at line 117 of file web_socket.h.
◆ WEB_SOCKET_REALM_MAX_LEN
#define WEB_SOCKET_REALM_MAX_LEN 32 |
Definition at line 124 of file web_socket.h.
◆ WEB_SOCKET_SERVER_KEY_SIZE
#define WEB_SOCKET_SERVER_KEY_SIZE 28 |
Definition at line 173 of file web_socket.h.
◆ WEB_SOCKET_SUB_PROTOCOL_MAX_LEN
#define WEB_SOCKET_SUB_PROTOCOL_MAX_LEN 8 |
Definition at line 103 of file web_socket.h.
◆ WEB_SOCKET_SUPPORT
#define WEB_SOCKET_SUPPORT DISABLED |
Definition at line 40 of file web_socket.h.
◆ WEB_SOCKET_TLS_SUPPORT
#define WEB_SOCKET_TLS_SUPPORT DISABLED |
Definition at line 54 of file web_socket.h.
◆ WEB_SOCKET_URI_MAX_LEN
#define WEB_SOCKET_URI_MAX_LEN 32 |
Definition at line 110 of file web_socket.h.
◆ WEB_SOCKET_USERNAME_MAX_LEN
#define WEB_SOCKET_USERNAME_MAX_LEN 16 |
Definition at line 131 of file web_socket.h.
◆ WebSocket
#define WebSocket struct _WebSocket |
Definition at line 177 of file web_socket.h.
Typedef Documentation
◆ WebSocketFrame
typedef { ... } WebSocketFrame |
WebSocket frame.
◆ WebSocketRandCallback
Random data generation callback function.
Definition at line 333 of file web_socket.h.
◆ WebSocketTlsInitCallback
typedef error_t(* WebSocketTlsInitCallback) (WebSocket *webSocket, TlsContext *tlsContext) |
TLS initialization callback function.
Definition at line 343 of file web_socket.h.
Enumeration Type Documentation
◆ WebSocketAuthMode
enum WebSocketAuthMode |
Authentication schemes.
Enumerator | |
---|---|
WS_AUTH_MODE_NONE | |
WS_AUTH_MODE_BASIC | |
WS_AUTH_MODE_DIGEST |
Definition at line 212 of file web_socket.h.
◆ WebSocketEndpoint
enum WebSocketEndpoint |
WebSocket endpoint types.
Enumerator | |
---|---|
WS_ENDPOINT_CLIENT | |
WS_ENDPOINT_SERVER |
Definition at line 189 of file web_socket.h.
◆ WebSocketFrameType
enum WebSocketFrameType |
WebSocket frame types.
Enumerator | |
---|---|
WS_FRAME_TYPE_CONTINUATION | |
WS_FRAME_TYPE_TEXT | |
WS_FRAME_TYPE_BINARY | |
WS_FRAME_TYPE_CLOSE | |
WS_FRAME_TYPE_PING | |
WS_FRAME_TYPE_PONG |
Definition at line 262 of file web_socket.h.
◆ WebSocketHttpVersion
enum WebSocketHttpVersion |
HTTP version numbers.
Enumerator | |
---|---|
WS_HTTP_VERSION_0_9 | |
WS_HTTP_VERSION_1_0 | |
WS_HTTP_VERSION_1_1 |
Definition at line 200 of file web_socket.h.
◆ WebSocketState
enum WebSocketState |
WebSocket states.
Definition at line 224 of file web_socket.h.
◆ WebSocketStatusCode
enum WebSocketStatusCode |
WebSocket status codes.
Definition at line 277 of file web_socket.h.
◆ WebSocketSubState
enum WebSocketSubState |
WebSocket sub-states.
Definition at line 244 of file web_socket.h.
Function Documentation
◆ webSocketBindToInterface()
error_t webSocketBindToInterface | ( | WebSocket * | webSocket, |
NetInterface * | interface | ||
) |
Bind the WebSocket to a particular network interface.
- Parameters
-
[in] webSocket Handle to a WebSocket [in] interface Network interface to be used
- Returns
- Error code
Definition at line 380 of file web_socket.c.
◆ webSocketClose()
void webSocketClose | ( | WebSocket * | webSocket | ) |
Close a WebSocket connection.
- Parameters
-
[in] webSocket Handle identifying the WebSocket to close
Definition at line 1556 of file web_socket.c.
◆ webSocketConnect()
error_t webSocketConnect | ( | WebSocket * | webSocket, |
const IpAddr * | serverIpAddr, | ||
uint16_t | serverPort, | ||
const char_t * | uri | ||
) |
Establish a WebSocket connection.
- Parameters
-
[in] webSocket Handle to a WebSocket [in] serverIpAddr IP address of the WebSocket server to connect to [in] serverPort TCP port number that will be used to establish the connection [in] uri NULL-terminated string that contains the resource name
- Returns
- Error code
Definition at line 404 of file web_socket.c.
◆ webSocketInit()
error_t webSocketInit | ( | void | ) |
◆ webSocketIsRxReady()
Check whether some data is available in the receive buffer.
- Parameters
-
[in] webSocket Handle to a WebSocket
- Returns
- The function returns TRUE if some data is pending and can be read immediately without blocking. Otherwise, FALSE is returned
Definition at line 1415 of file web_socket.c.
◆ webSocketOpen()
WebSocket* webSocketOpen | ( | void | ) |
Create a WebSocket.
- Returns
- Handle referencing the new WebSocket
Definition at line 95 of file web_socket.c.
◆ webSocketParseClientHandshake()
Parse client's handshake.
- Parameters
-
[in] webSocket Handle that identifies a WebSocket
- Returns
- Error code
Definition at line 725 of file web_socket.c.
◆ webSocketReceive()
error_t webSocketReceive | ( | WebSocket * | webSocket, |
void * | data, | ||
size_t | size, | ||
WebSocketFrameType * | type, | ||
size_t * | received | ||
) |
Receive data from a WebSocket connection.
- Parameters
-
[in] webSocket Handle that identifies a WebSocket [out] data Buffer where to store the incoming data [in] size Maximum number of bytes that can be received [out] type Frame type [out] received Number of bytes that have been received
- Returns
- Error code
Definition at line 1137 of file web_socket.c.
◆ webSocketReceiveEx()
error_t webSocketReceiveEx | ( | WebSocket * | webSocket, |
void * | data, | ||
size_t | size, | ||
WebSocketFrameType * | type, | ||
size_t * | received, | ||
bool_t * | firstFrag, | ||
bool_t * | lastFrag | ||
) |
Receive data from a WebSocket connection.
- Parameters
-
[in] webSocket Handle that identifies a WebSocket [out] data Buffer where to store the incoming data [in] size Maximum number of bytes that can be received [out] type Frame type [out] received Number of bytes that have been received [out] firstFrag First fragment of the message [out] lastFrag Last fragment of the message
- Returns
- Error code
Definition at line 1160 of file web_socket.c.
◆ webSocketRegisterRandCallback()
error_t webSocketRegisterRandCallback | ( | WebSocketRandCallback | callback | ) |
Register RNG callback function.
- Parameters
-
[in] callback RNG callback function
- Returns
- Error code
Definition at line 76 of file web_socket.c.
◆ webSocketRegisterTlsInitCallback()
error_t webSocketRegisterTlsInitCallback | ( | WebSocket * | webSocket, |
WebSocketTlsInitCallback | callback | ||
) |
Register TLS initialization callback function.
- Parameters
-
[in] webSocket Handle that identifies a WebSocket [in] callback TLS initialization callback function
- Returns
- Error code
Definition at line 233 of file web_socket.c.
◆ webSocketSend()
error_t webSocketSend | ( | WebSocket * | webSocket, |
const void * | data, | ||
size_t | length, | ||
WebSocketFrameType | type, | ||
size_t * | written | ||
) |
Transmit data over the WebSocket connection.
- Parameters
-
[in] webSocket Handle that identifies a WebSocket [in] data Pointer to a buffer containing the data to be transmitted [in] length Number of data bytes to send [in] type Frame type [out] written Actual number of bytes written (optional parameter)
- Returns
- Error code
Definition at line 952 of file web_socket.c.
◆ webSocketSendErrorResponse()
error_t webSocketSendErrorResponse | ( | WebSocket * | webSocket, |
uint_t | statusCode, | ||
const char_t * | message | ||
) |
Send HTTP error response to the client.
- Parameters
-
[in] webSocket Handle that identifies a WebSocket [in] statusCode HTTP status code [in] message Text message
- Returns
- Error code
Definition at line 877 of file web_socket.c.
◆ webSocketSendEx()
error_t webSocketSendEx | ( | WebSocket * | webSocket, |
const void * | data, | ||
size_t | length, | ||
WebSocketFrameType | type, | ||
size_t * | written, | ||
bool_t | firstFrag, | ||
bool_t | lastFrag | ||
) |
Transmit data over the WebSocket connection.
- Parameters
-
[in] webSocket Handle that identifies a WebSocket [in] data Pointer to a buffer containing the data to be transmitted [in] length Number of data bytes to send [in] type Frame type [out] written Actual number of bytes written (optional parameter) [in] firstFrag First fragment of the message [in] lastFrag Last fragment of the message
Definition at line 973 of file web_socket.c.
◆ webSocketSendServerHandshake()
Send server's handshake.
- Parameters
-
[in] webSocket Handle that identifies a WebSocket
- Returns
- Error code
Definition at line 814 of file web_socket.c.
◆ webSocketSetAuthInfo()
error_t webSocketSetAuthInfo | ( | WebSocket * | webSocket, |
const char_t * | username, | ||
const char_t * | password, | ||
uint_t | allowedAuthModes | ||
) |
Set authentication information.
- Parameters
-
[in] webSocket Handle to a WebSocket [in] username NULL-terminated string containing the user name to be used [in] password NULL-terminated string containing the password to be used [in] allowedAuthModes Logic OR of allowed HTTP authentication schemes
- Returns
- Error code
Definition at line 347 of file web_socket.c.
◆ webSocketSetClientKey()
Set client's key.
- Parameters
-
[in] webSocket Handle to a WebSocket [in] clientKey NULL-terminated string that holds the client's key
- Returns
- Error code
Definition at line 659 of file web_socket.c.
◆ webSocketSetHost()
Set the domain name of the server (for virtual hosting)
- Parameters
-
[in] webSocket Handle to a WebSocket [in] host NULL-terminated string containing the hostname
- Returns
- Error code
Definition at line 282 of file web_socket.c.
◆ webSocketSetOrigin()
Set the origin header field.
- Parameters
-
[in] webSocket Handle to a WebSocket [in] origin NULL-terminated string containing the origin
- Returns
- Error code
Definition at line 303 of file web_socket.c.
◆ webSocketSetSubProtocol()
Set the sub-protocol header field.
- Parameters
-
[in] webSocket Handle to a WebSocket [in] subProtocol NULL-terminated string containing the sub-protocol
- Returns
- Error code
Definition at line 324 of file web_socket.c.
◆ webSocketSetTimeout()
Set timeout value for blocking operations.
- Parameters
-
[in] webSocket Handle to a WebSocket [in] timeout Maximum time to wait
- Returns
- Error code
Definition at line 257 of file web_socket.c.
◆ webSocketShutdown()
Gracefully close a WebSocket connection.
- Parameters
-
[in] webSocket Handle to a WebSocket
Definition at line 1440 of file web_socket.c.
◆ webSocketUpgradeSecureSocket()
WebSocket* webSocketUpgradeSecureSocket | ( | Socket * | socket, |
TlsContext * | tlsContext | ||
) |
Upgrade a secure socket to a secure WebSocket.
- Parameters
-
[in] socket Handle referencing the socket [in] tlsContext Pointer to the TLS context
- Returns
- Handle referencing the new WebSocket
Definition at line 194 of file web_socket.c.
◆ webSocketUpgradeSocket()
Upgrade a socket to a WebSocket.
- Parameters
-
[in] socket Handle referencing the socket
- Returns
- Handle referencing the new WebSocket
Definition at line 155 of file web_socket.c.
Variable Documentation
◆ extPayloadLen
uint8_t extPayloadLen[] |
Definition at line 319 of file web_socket.h.
◆ fin
uint8_t fin |
Definition at line 315 of file web_socket.h.
◆ mask
uint8_t mask |
Definition at line 317 of file web_socket.h.
◆ opcode
uint8_t opcode |
Definition at line 313 of file web_socket.h.
◆ payloadLen
uint8_t payloadLen |
Definition at line 316 of file web_socket.h.
◆ reserved
uint8_t reserved |
Definition at line 314 of file web_socket.h.
◆ webSockRandCallback
|
extern |
Definition at line 52 of file web_socket.c.