Skip to content

uvhttp_websocket.c ​

Functions ​

uvhttp_ws_strcasestr(const char *haystack, const char *needle) ​

Return Type: const char *

uvhttp_ws_random_bytes(uvhttp_context_t *context, unsigned char *buf, size_t len) ​

Return Type: int

uvhttp_ws_connection_create(int fd, mbedtls_ssl_context *ssl, int is_server, const uvhttp_config_t *config) ​

Return Type: struct uvhttp_ws_connection *

uvhttp_ws_connection_free(struct uvhttp_ws_connection *conn) ​

Return Type: void

uvhttp_ws_parse_frame_header(const uint8_t *data, size_t len, uvhttp_ws_frame_header_t *header, size_t *header_size) ​

uvhttp_ws_apply_mask(uint8_t *data, size_t len, const uint8_t *masking_key) ​

Return Type: void

uvhttp_ws_build_frame(uvhttp_context_t *context, uint8_t *buffer, size_t buffer_size, const uint8_t *payload, size_t payload_len, uvhttp_ws_opcode_t opcode, int mask, int fin) ​

Return Type: long

uvhttp_ws_generate_accept(const char *key, char *accept, size_t accept_len) ​

uvhttp_ws_verify_accept(const char *key, const char *accept) ​

uvhttp_ws_handshake_server(struct uvhttp_ws_connection *conn, const char *request, size_t request_len, char *response, size_t *response_len) ​

uvhttp_ws_handshake_client(uvhttp_context_t *context, struct uvhttp_ws_connection *conn, const char *host, const char *path, char *request, size_t *request_len) ​

uvhttp_ws_verify_handshake_response(struct uvhttp_ws_connection *conn, const char *response, size_t response_len) ​

uvhttp_ws_send_frame(uvhttp_context_t *context, struct uvhttp_ws_connection *conn, const uint8_t *data, size_t len, uvhttp_ws_opcode_t opcode) ​

uvhttp_ws_send_text(uvhttp_context_t *context, struct uvhttp_ws_connection *conn, const char *text, size_t len) ​

uvhttp_ws_send_binary(uvhttp_context_t *context, struct uvhttp_ws_connection *conn, const uint8_t *data, size_t len) ​

uvhttp_ws_send_ping(uvhttp_context_t *context, struct uvhttp_ws_connection *conn, const uint8_t *data, size_t len) ​

uvhttp_ws_send_pong(uvhttp_context_t *context, struct uvhttp_ws_connection *conn, const uint8_t *data, size_t len) ​

uvhttp_ws_close(uvhttp_context_t *context, struct uvhttp_ws_connection *conn, int code, const char *reason) ​

uvhttp_ws_recv_frame(struct uvhttp_ws_connection *conn, uvhttp_ws_frame_t *frame) ​

uvhttp_ws_fragment_append(struct uvhttp_ws_connection *conn, const uint8_t *payload, size_t payload_len) ​

uvhttp_ws_process_data(struct uvhttp_ws_connection *conn, const uint8_t *data, size_t len) ​

uvhttp_ws_set_callbacks(struct uvhttp_ws_connection *conn, uvhttp_ws_on_message_callback on_message, uvhttp_ws_on_close_callback on_close, uvhttp_ws_on_error_callback on_error) ​

Return Type: void

attribute((unused)) ​

websocket_protocol_detector(uvhttp_request_t *request, char *protocol_name, size_t protocol_name_len, const char *upgrade_header, const char *connection_header) ​

Return Type: int

WebSocket protocol detector.

websocket_upgrade_handler(uvhttp_connection_t *conn, const char *protocol_name, void *user_data) ​

WebSocket upgrade handler.

uvhttp_server_register_websocket_upgrade(uvhttp_server_t *server) ​

Register WebSocket protocol upgrade.

Released under MIT License