Handler List

Handler Trigger Notes
open(connection_hdl) Successful new connection Either open or fail will be called for each connection. Never both.
fail(connection_hdl) Connection failed (before opening) Either open or fail will be called for each connection. Never both.
close(connection_hdl) Connection closed (after opening) Close will be called exactly once for every connection that open was called for. Close is not called for failed connections.
message(connection_hdl, message_ptr) Message received message_ptr type depends on endpoint.
bool ping(connection_hdl, std::string) Ping received Second argument is binary ping payload. Return false to suppress a pong response.
pong(connection_hdl, std::string) Pong received Second argument is binary pong payload.
pong_timeout(connection_hdl, std::string) Timed out while waiting for a pong from the remote endpoint Second argument is the binary payload of the unanswered ping.
interrupt(connection_hdl) Connection was manually interrupted
bool validate(connection_hdl) Accept or reject an incoming connection Server role only. Return true to accept the connection, false to reject.
http(connection_hdl) Process an HTTP connection Server role only. Called when HTTP requests that are not WebSocket handshake upgrade requests are received. Allows HTTP responses.
socket_init(connection_hdl, boost::asio::ip::tcp::socket&) Socket initialization Asio Transport only. Allows specifying ASIO socket options.
tcp_pre_init(connection_hdl) TCP connection has been established but no pre-handshake operations have been run yet. Asio Transport only. Pre-handshake operations include TLS handshakes, proxy connects, etc.
tcp_post_init(connection_hdl) TCP connection has been established and pre-handshake operations have been run. Asio Transport only. Pre-handshake operations include TLS handshakes, proxy connects, etc.
tls_context_ptr tls_init(connection_hdl) Request for TLS context Asio transport with TLS only. You must return a pointer to the TLS context you want to use from this handler for TLS operations to continue.

Add new comment

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.