Zephyr Project API 4.0.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
websocket.h File Reference

Websocket API. More...

Go to the source code of this file.

Data Structures

struct  websocket_request
 Websocket client connection request. More...
 

Macros

#define WEBSOCKET_FLAG_FINAL   0x00000001
 Message type values.
 
#define WEBSOCKET_FLAG_TEXT   0x00000002
 Textual data

 
#define WEBSOCKET_FLAG_BINARY   0x00000004
 Binary data

 
#define WEBSOCKET_FLAG_CLOSE   0x00000008
 Closing connection.
 
#define WEBSOCKET_FLAG_PING   0x00000010
 Ping message

 
#define WEBSOCKET_FLAG_PONG   0x00000020
 Pong message

 

Typedefs

typedef int(* websocket_connect_cb_t) (int ws_sock, struct http_request *req, void *user_data)
 Callback called after Websocket connection is established.
 

Enumerations

enum  websocket_opcode {
  WEBSOCKET_OPCODE_CONTINUE = 0x00 , WEBSOCKET_OPCODE_DATA_TEXT = 0x01 , WEBSOCKET_OPCODE_DATA_BINARY = 0x02 , WEBSOCKET_OPCODE_CLOSE = 0x08 ,
  WEBSOCKET_OPCODE_PING = 0x09 , WEBSOCKET_OPCODE_PONG = 0x0A
}
 Websocket option codes. More...
 

Functions

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_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_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.
 
int websocket_disconnect (int ws_sock)
 Close websocket.
 
int websocket_register (int http_sock, uint8_t *recv_buf, size_t recv_buf_len)
 Register a socket as websocket.
 
int websocket_unregister (int ws_sock)
 Unregister a websocket.
 

Detailed Description

Websocket API.

An API for applications to setup websocket connections