cef_server_handler_t

Implement this structure to handle HTTP server requests. A new thread will be created for each cef_server_t::CreateServer call (the "dedicated server thread"), and the functions of this structure will be called on that thread. It is therefore recommended to use a different cef_server_handler_t instance for each cef_server_t::CreateServer call to avoid thread safety issues in the cef_server_handler_t implementation.

Members

Variables

base
cef_base_ref_counted_t base;

Base structure.

on_client_connected
void function(cef_server_handler_t* self, cef_server_t* server, int connection_id) nothrow on_client_connected;

Called when a client connects to |server|. |connection_id| uniquely identifies the connection. Each call to this function will have a matching call to OnClientDisconnected.

on_client_disconnected
void function(cef_server_handler_t* self, cef_server_t* server, int connection_id) nothrow on_client_disconnected;

Called when a client disconnects from |server|. |connection_id| uniquely identifies the connection. The client should release any data associated with |connection_id| when this function is called and |connection_id| should no longer be passed to cef_server_t functions. Disconnects can originate from either the client or the server. For example, the server will disconnect automatically after a cef_server_t::SendHttpXXXResponse function is called.

on_http_request
void function(cef_server_handler_t* self, cef_server_t* server, int connection_id, const(cef_string_t)* client_address, cef_request_t* request) nothrow on_http_request;

Called when |server| receives an HTTP request. |connection_id| uniquely identifies the connection, |client_address| is the requesting IPv4 or IPv6 client address including port number, and |request| contains the request contents (URL, function, headers and optional POST data). Call cef_server_t functions either synchronously or asynchronusly to send a response.

on_server_created
void function(cef_server_handler_t* self, cef_server_t* server) nothrow on_server_created;

Called when |server| is created. If the server was started successfully then cef_server_t::IsRunning will return true (1). The server will continue running until cef_server_t::Shutdown is called, after which time OnServerDestroyed will be called. If the server failed to start then OnServerDestroyed will be called immediately after this function returns.

on_server_destroyed
void function(cef_server_handler_t* self, cef_server_t* server) nothrow on_server_destroyed;

Called when |server| is destroyed. The server thread will be stopped after this function returns. The client should release any references to |server| when this function is called. See OnServerCreated documentation for a description of server lifespan.

on_web_socket_connected
void function(cef_server_handler_t* self, cef_server_t* server, int connection_id) nothrow on_web_socket_connected;

Called after the client has accepted the WebSocket connection for |server| and |connection_id| via the OnWebSocketRequest callback. See OnWebSocketRequest documentation for intended usage.

on_web_socket_message
void function(cef_server_handler_t* self, cef_server_t* server, int connection_id, const(void)* data, size_t data_size) nothrow on_web_socket_message;

Called when |server| receives an WebSocket message. |connection_id| uniquely identifies the connection, |data| is the message content and |data_size| is the size of |data| in bytes. Do not keep a reference to |data| outside of this function. See OnWebSocketRequest documentation for intended usage.

on_web_socket_request
void function(cef_server_handler_t* self, cef_server_t* server, int connection_id, const(cef_string_t)* client_address, cef_request_t* request, cef_callback_t* callback) nothrow on_web_socket_request;

Called when |server| receives a WebSocket request. |connection_id| uniquely identifies the connection, |client_address| is the requesting IPv4 or IPv6 client address including port number, and |request| contains the request contents (URL, function, headers and optional POST data). Execute |callback| either synchronously or asynchronously to accept or decline the WebSocket connection. If the request is accepted then OnWebSocketConnected will be called after the WebSocket has connected and incoming messages will be delivered to the OnWebSocketMessage callback. If the request is declined then the client will be disconnected and OnClientDisconnected will be called. Call the

Meta