LibHTTP API Reference

December 26, 2016 ยท View on GitHub

httplib_connect_websocket_client( host, port, use_ssl, error_buffer, error_buffer_size, path, origin, data_func, close_func, user-data);

Parameters

ParameterTypeDescription
hostconst char *The hostname or IP address of the server
portintThe port on the server
use_sslintUse SSL if this parameter is not equal to zero
error_bufferchar *Buffer to store an error message
error_buffer_sizesize_tSize of the error message buffer including the NUL terminator
pathconst char *The server path to connect to, for example /app if you want to connect to localhost/app
originconst char *The value of the Origin HTTP header
data_funchttplib_websocket_data_handlerCallback which is used to process data coming back from the server
close_funchttplib_websocket_close_handlerCallback which is called when the connection is to be closed
user_datavoid *User supplied argument

Return Value

TypeDescription
struct httplib_connection *A pointer to the connection structure, or NULL if connecting failed

Description

The function httplib_connect_websocket_client() connects to a websocket on a server as a client. Data and close events are processed with callback functions which must be provided in the call.

See Also