13#ifndef ZEPHYR_INCLUDE_NET_WEBSOCKET_H_
14#define ZEPHYR_INCLUDE_NET_WEBSOCKET_H_
36#define WEBSOCKET_FLAG_FINAL 0x00000001
37#define WEBSOCKET_FLAG_TEXT 0x00000002
38#define WEBSOCKET_FLAG_BINARY 0x00000004
39#define WEBSOCKET_FLAG_CLOSE 0x00000008
40#define WEBSOCKET_FLAG_PING 0x00000010
41#define WEBSOCKET_FLAG_PONG 0x00000020
130 int32_t timeout,
void *user_data);
220#if defined(CONFIG_WEBSOCKET_CLIENT)
221void websocket_init(
void);
223static inline void websocket_init(
void)
int(* http_header_cb_t)(int sock, struct http_request *req, void *user_data)
Callback can be used if application wants to construct additional HTTP headers when the HTTP request ...
Definition client.h:85
int websocket_recv_msg(int ws_sock, uint8_t *buf, size_t buf_len, uint32_t *message_type, uint64_t *remaining, int32_t timeout)
Receive websocket msg from peer.
websocket_opcode
Websocket option codes.
Definition websocket.h:44
int websocket_connect(int http_sock, struct websocket_request *req, int32_t timeout, void *user_data)
Connect to a server that provides Websocket service.
int websocket_unregister(int ws_sock)
Unregister a websocket.
int(* websocket_connect_cb_t)(int ws_sock, struct http_request *req, void *user_data)
Callback called after Websocket connection is established.
Definition websocket.h:63
int websocket_register(int http_sock, uint8_t *recv_buf, size_t recv_buf_len)
Register a socket as websocket.
int websocket_send_msg(int ws_sock, const uint8_t *payload, size_t payload_len, enum websocket_opcode opcode, bool mask, bool final, int32_t timeout)
Send websocket msg to peer.
int websocket_disconnect(int ws_sock)
Close websocket.
@ WEBSOCKET_OPCODE_PONG
Pong message.
Definition websocket.h:50
@ WEBSOCKET_OPCODE_DATA_TEXT
Textual data.
Definition websocket.h:46
@ WEBSOCKET_OPCODE_CLOSE
Closing connection.
Definition websocket.h:48
@ WEBSOCKET_OPCODE_CONTINUE
Message continues.
Definition websocket.h:45
@ WEBSOCKET_OPCODE_DATA_BINARY
Binary data.
Definition websocket.h:47
@ WEBSOCKET_OPCODE_PING
Ping message.
Definition websocket.h:49
IPv6 and IPv4 definitions.
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__INT32_TYPE__ int32_t
Definition stdint.h:74
__UINT64_TYPE__ uint64_t
Definition stdint.h:91
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
HTTP client request.
Definition client.h:230
Websocket client connection request.
Definition websocket.h:70
size_t tmp_buf_len
Length of the user supplied temp buffer.
Definition websocket.h:108
const struct http_parser_settings * http_cb
User supplied list of callback functions if the calling application wants to know the parsing status ...
Definition websocket.h:102
const char * url
URL of the Websocket.
Definition websocket.h:75
const char ** optional_headers
A NULL terminated list of any optional headers that should be added to the HTTP request.
Definition websocket.h:89
const char * host
Host of the Websocket server when doing HTTP handshakes.
Definition websocket.h:72
uint8_t * tmp_buf
User supplied buffer where HTTP connection data is stored.
Definition websocket.h:105
websocket_connect_cb_t cb
User supplied callback function to call when a connection is established.
Definition websocket.h:94
http_header_cb_t optional_headers_cb
User supplied callback function to call when optional headers need to be sent.
Definition websocket.h:83