Functions
noPoll Connection: functions required to create WebSocket client connections.

Functions

nopoll_bool __nopoll_conn_accept_complete_common (noPollCtx *ctx, noPollConnOpts *options, noPollConn *listener, noPollConn *conn, NOPOLL_SOCKET session, nopoll_bool tls_on)
 
nopoll_bool __nopoll_conn_set_ssl_client_options (noPollCtx *ctx, noPollConn *conn, noPollConnOpts *options)
 
noPollConnnopoll_conn_accept (noPollCtx *ctx, noPollConn *listener)
 Allows to accept a new incoming WebSocket connection on the provided listener. More...
 
nopoll_bool nopoll_conn_accept_complete (noPollCtx *ctx, noPollConn *listener, noPollConn *conn, NOPOLL_SOCKET session, nopoll_bool tls_on)
 Allows to complete accept operation by setting up all I/O handlers required to make the WebSocket connection to work. More...
 
noPollConnnopoll_conn_accept_socket (noPollCtx *ctx, noPollConn *listener, NOPOLL_SOCKET session)
 Allows to accept a new incoming WebSocket connection on the provided listener but with a socket already accepted. More...
 
void nopoll_conn_close (noPollConn *conn)
 Allows to close an opened noPollConn no matter its role (noPollRole). More...
 
void nopoll_conn_close_ext (noPollConn *conn, int status, const char *reason, int reason_size)
 Allows to close an opened noPollConn no matter its role (noPollRole). More...
 
void nopoll_conn_complete_handshake (noPollConn *conn)
 internal api More...
 
int nopoll_conn_complete_pending_write (noPollConn *conn)
 Allows to call to complete last pending write process that may be pending from a previous uncompleted write operation. More...
 
void nopoll_conn_connect_timeout (noPollCtx *ctx, long microseconds_to_wait)
 Allows to configure nopoll connect timeout. More...
 
noPollCtxnopoll_conn_ctx (noPollConn *conn)
 Allows to get the noPollCtx context object associated to the connection (or where the connection is working). More...
 
int nopoll_conn_flush_writes (noPollConn *conn, long timeout, int previous_result)
 Ready to use function that checks for pending write operations and flush them waiting until they are done or until the timeout provided by the user is reached. More...
 
const char * nopoll_conn_get_accepted_protocol (noPollConn *conn)
 Allows to get accepted protocol in the case a protocol was requested during connection. More...
 
const char * nopoll_conn_get_close_reason (noPollConn *conn)
 Optionally, remote peer can close the connection providing an error code (nopoll_conn_get_close_status) and a reason (nopoll_conn_get_close_reason). More...
 
int nopoll_conn_get_close_status (noPollConn *conn)
 Optionally, remote peer can close the connection providing an error code (nopoll_conn_get_close_status) and a reason (nopoll_conn_get_close_reason). More...
 
long nopoll_conn_get_connect_timeout (noPollCtx *ctx)
 Allows to get current timeout set for noPollConn connect operation. More...
 
const char * nopoll_conn_get_cookie (noPollConn *conn)
 Allows to get cookie header content received during handshake (if received). More...
 
noPollPtr nopoll_conn_get_hook (noPollConn *conn)
 Allows to get the user level pointer defined by nopoll_conn_get_hook. More...
 
const char * nopoll_conn_get_host_header (noPollConn *conn)
 Allows to get the Host: header value that was received for this connection during the handshake. More...
 
int nopoll_conn_get_id (noPollConn *conn)
 Allows to get the connection id from the provided connection. More...
 
noPollConnnopoll_conn_get_listener (noPollConn *conn)
 Allows to get the master listener that was used to accept the provided connection that represents a listener connection. More...
 
noPollMsgnopoll_conn_get_msg (noPollConn *conn)
 Allows to get the next message available on the provided connection. More...
 
const char * nopoll_conn_get_origin (noPollConn *conn)
 Allows to get the connection Origin header content received. More...
 
const char * nopoll_conn_get_requested_protocol (noPollConn *conn)
 Allows to get requested protocols for the provided connection. More...
 
const char * nopoll_conn_get_requested_url (noPollConn *conn)
 Allows to get the get_url from the connection. More...
 
const char * nopoll_conn_host (noPollConn *conn)
 Returns the host location this connection connects to or it is listening (according to the connection role noPollRole). More...
 
nopoll_bool nopoll_conn_is_ok (noPollConn *conn)
 Allows to check if the provided connection is in connected state (just to the connection). More...
 
nopoll_bool nopoll_conn_is_ready (noPollConn *conn)
 Allows to check if the connection is ready to be used (handshake completed). More...
 
nopoll_bool nopoll_conn_is_tls_on (noPollConn *conn)
 Allows to check if the provided connection is working under a TLS session. More...
 
noPollConnnopoll_conn_new (noPollCtx *ctx, const char *host_ip, const char *host_port, const char *host_name, const char *get_url, const char *protocols, const char *origin)
 Creates a new Websocket connection to the provided destination, physically located at host_ip and host_port (IPv4 version). More...
 
noPollConnnopoll_conn_new6 (noPollCtx *ctx, const char *host_ip, const char *host_port, const char *host_name, const char *get_url, const char *protocols, const char *origin)
 Creates a new Websocket connection to the provided destination, physically located at host_ip and host_port (IPv6 version). More...
 
noPollConnnopoll_conn_new_opts (noPollCtx *ctx, noPollConnOpts *opts, const char *host_ip, const char *host_port, const char *host_name, const char *get_url, const char *protocols, const char *origin)
 Creates a new Websocket connection to the provided destination, physically located at host_ip and host_port and allowing to provide a noPollConnOpts object. More...
 
noPollConnnopoll_conn_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)
 Creates a new Websocket connection using a socket with a preestablished connection. More...
 
int nopoll_conn_pending_write_bytes (noPollConn *conn)
 Allows to check if there are pending write bytes. More...
 
const char * nopoll_conn_port (noPollConn *conn)
 Returns the port location this connection connects to or it is listening (according to the connection role noPollRole). More...
 
int nopoll_conn_read (noPollConn *conn, char *buffer, int bytes, nopoll_bool block, long int timeout)
 Allows to read the provided amount of bytes from the provided connection, leaving the content read on the buffer provided. More...
 
int nopoll_conn_read_pending (noPollConn *conn)
 Allows to check if the are pending bytes to be read on the provided connection and that are retained in internal buffers so the socket associated will not report pending content. More...
 
nopoll_bool nopoll_conn_ref (noPollConn *conn)
 Allows to acquire a reference to the provided connection. More...
 
int nopoll_conn_ref_count (noPollConn *conn)
 Allows to get current reference counting state for the provided connection. More...
 
noPollRole nopoll_conn_role (noPollConn *conn)
 Allows to get the connection role. More...
 
int nopoll_conn_send_binary (noPollConn *conn, const char *content, long length)
 Allows to send a binary (op code 2) message over the provided connection with the provided length. More...
 
int nopoll_conn_send_binary_fragment (noPollConn *conn, const char *content, long length)
 Allows to send a binary (op code 2) message over the provided connection with the provided length but flagging the frame sent as not complete (more frames to come, that is, FIN = 0). More...
 
nopoll_bool nopoll_conn_send_ping (noPollConn *conn)
 Allows to send a ping message over the Websocket connection provided. More...
 
int nopoll_conn_send_text (noPollConn *conn, const char *content, long length)
 Allows to send an UTF-8 text (op code 1) message over the provided connection with the provided length. More...
 
int nopoll_conn_send_text_fragment (noPollConn *conn, const char *content, long length)
 Allows to send an UTF-8 text (op code 1) message over the provided connection with the provided length but flagging the frame sent as not complete (more frames to come, that is, FIN = 0). More...
 
void nopoll_conn_set_accepted_protocol (noPollConn *conn, const char *protocol)
 Allows to configure accepted protocol on the provided connection. More...
 
nopoll_bool nopoll_conn_set_bind_interface (NOPOLL_SOCKET socket, noPollConnOpts *options)
 Allows to configure which network interface to bind to. More...
 
void nopoll_conn_set_hook (noPollConn *conn, noPollPtr ptr)
 Allows to define a user level pointer associated to this connection. More...
 
void nopoll_conn_set_on_close (noPollConn *conn, noPollOnCloseHandler on_close, noPollPtr user_data)
 Allows to configure an OnClose handler that will be called when the connection is closed. More...
 
void nopoll_conn_set_on_msg (noPollConn *conn, noPollOnMessageHandler on_msg, noPollPtr user_data)
 Allows to configure an on message handler on the provided connection that overrides the one configured at noPollCtx. More...
 
void nopoll_conn_set_on_ready (noPollConn *conn, noPollActionHandler on_ready, noPollPtr user_data)
 Allows to configure a handler that is called when the connection provided is ready to send and receive because all WebSocket handshake protocol finished OK. More...
 
nopoll_bool nopoll_conn_set_sock_block (NOPOLL_SOCKET socket, nopoll_bool enable)
 Allows to enable/disable non-blocking/blocking behavior on the provided socket. More...
 
nopoll_bool nopoll_conn_set_sock_tcp_nodelay (NOPOLL_SOCKET socket, nopoll_bool enable)
 Allows to configure tcp no delay flag (enable/disable Nagle algorithm). More...
 
void nopoll_conn_set_socket (noPollConn *conn, NOPOLL_SOCKET _socket)
 Allows to set up the socket reference to be used by this noPollConn. More...
 
void nopoll_conn_shutdown (noPollConn *conn)
 Call to close the connection immediately without going through websocket close negotiation. More...
 
NOPOLL_SOCKET nopoll_conn_socket (noPollConn *conn)
 Allows to get the socket associated to this nopoll connection. More...
 
noPollConnnopoll_conn_tls_new (noPollCtx *ctx, noPollConnOpts *options, 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 (IPv4 version). More...
 
noPollConnnopoll_conn_tls_new6 (noPollCtx *ctx, noPollConnOpts *options, 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 (IPv6 version). More...
 
noPollConnnopoll_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. More...
 
void nopoll_conn_unref (noPollConn *conn)
 Allows to unref connection reference acquired via nopoll_conn_ref. More...
 
nopoll_bool nopoll_conn_wait_until_connection_ready (noPollConn *conn, int timeout)
 Allows to implement a wait operation until the provided connection is ready or the provided timeout is reached. More...
 

Detailed Description