void nopoll_ctx_set_on_open ( noPollCtx ctx,
noPollActionHandler  on_open,
noPollPtr  user_data 
)

Allows to configure the on open handler, the handler that is called when it is received an incoming websocket connection and all websocket client handshake data was received (but still not required).

This handler differs from nopoll_ctx_set_on_accept this handler is called after all client handshake data was received.

Note the connection is still not fully working at this point because the handshake hasn't been sent to the remote peer yet. This means that attempting to send any content inside this handler (for example by using nopoll_conn_send_text) will cause a protocol violation (because remote side is expecting a handshake reply but received something different).

In the case you want to sent content right away after receiving a connection (on a listener), you can use On Ready handler which is called just after the connection has been fully accepted and handshake reply is fully written.

Parameters
ctxThe context that will be configured.
on_openThe handler to be configured on this context.
user_dataUser defined pointer to be passed to the on open handler

References nopoll_return_if_fail.