noPollConn* nopoll_conn_tls_new_with_socket ( noPollCtx ctx,
noPollConnOpts options,
int  socket,
const char *  host_ip,
const char *  host_port,
const char *  host_name,
const char *  get_url,
const char *  protocols,
const char *  origin 
)

Allows to create a client WebSocket connection over TLS using a preestablished socket.

The function works like nopoll_conn_tls_new with the same semantics but providing a way to create a WebSocket session under TLS supervision with a preestablished socket. See nopoll_conn_tls_new and nopoll_conn_new_with_socket for more information.

Parameters
ctxThe context where the operation will take place.
optionsOptional configuration object. See nopoll_conn_opts_new and nopoll_conn_opts_set_ssl_protocol (for example).
socketSocket FD with an already established connection.
host_ipThe websocket server address to connect to.
host_portThe websocket server port to connect to. If NULL is provided, port 443 is used.
host_nameThis is the Host: header value that will be sent. This header is used by the websocket server to activate the right virtual host configuration. If null is provided, Host: will use host_ip value.
get_urlAs part of the websocket handshake, an url is passed to the remote server inside a GET method. This parameter allows to configure this. If NULL is provided, then / will be used.
originWebsocket origin to be notified to the server.
protocolsOptional protocols requested to be activated for this connection (an string of list of strings separated by a white space). If the server accepts the connection you can use nopoll_conn_get_accepted_protocol to get the protocol accepted by the server.
Returns
A reference to the connection created or NULL if it fails. Keep in mind the connection reported may not be connected at the time is returned by this function. You can use nopoll_conn_is_ready and nopoll_conn_is_ok to ensure it can be used. There is also a helper function (NOTE it is blocking) that can help you implement a very simple wait until ready operation: nopoll_conn_wait_until_connection_ready (however, it is not recommended for any serious, non-command line programming).

References NOPOLL_TRANSPORT_IPV4, and nopoll_true.