WebSockets

WebSockets — The WebSocket Protocol

Includes

#include <libsoup/soup.h>

Description

SoupWebsocketConnection provides support for the WebSocket protocol.

To connect to a WebSocket server, create a SoupSession and call soup_session_websocket_connect_async(). To accept WebSocket connections, create a SoupServer and add a handler to it with soup_server_add_websocket_handler().

(Lower-level support is available via soup_websocket_client_prepare_handshake() and soup_websocket_client_verify_handshake(), for handling the client side of the WebSocket handshake, and soup_websocket_server_process_handshake() for handling the server side.)

SoupWebsocketConnection handles the details of WebSocket communication. You can use soup_websocket_connection_send_text() and soup_websocket_connection_send_binary() to send data, and the “message” signal to receive data. (SoupWebsocketConnection currently only supports asynchronous I/O.)

Functions

Types and Values

See Also

soup_session_websocket_connect_async(), soup_server_add_websocket_handler()