private static unsafe void OnWebSocketConnectedImpl(cef_server_handler_t *self, cef_server_t *server, int connection_id) { var instance = GetInstance((IntPtr)self) as CefServerHandler; if (instance == null || ((ICefServerHandlerPrivate)instance).AvoidOnWebSocketConnected()) { ReleaseIfNonNull((cef_base_ref_counted_t *)server); return; } instance.OnWebSocketConnected(CefServer.Wrap(CefServer.Create, server), connection_id); }
private static unsafe void OnWebSocketMessageImpl(cef_server_handler_t *self, cef_server_t *server, int connection_id, void *data, UIntPtr data_size) { var instance = GetInstance((IntPtr)self) as CefServerHandler; if (instance == null || ((ICefServerHandlerPrivate)instance).AvoidOnWebSocketMessage()) { ReleaseIfNonNull((cef_base_ref_counted_t *)server); return; } instance.OnWebSocketMessage(CefServer.Wrap(CefServer.Create, server), connection_id, unchecked ((IntPtr)data), (long)data_size); }
private static unsafe void OnHttpRequestImpl(cef_server_handler_t *self, cef_server_t *server, int connection_id, cef_string_t *client_address, cef_request_t *request) { var instance = GetInstance((IntPtr)self) as CefServerHandler; if (instance == null || ((ICefServerHandlerPrivate)instance).AvoidOnHttpRequest()) { ReleaseIfNonNull((cef_base_ref_counted_t *)server); ReleaseIfNonNull((cef_base_ref_counted_t *)request); return; } instance.OnHttpRequest(CefServer.Wrap(CefServer.Create, server), connection_id, CefString.Read(client_address), CefRequest.Wrap(CefRequest.Create, request)); }
/// <summary> /// 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. /// </summary> protected internal unsafe virtual void OnServerCreated(CefServer server) { }
/// <summary> /// 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. /// </summary> protected internal unsafe virtual void OnWebSocketMessage(CefServer server, int connectionId, IntPtr data, long dataSize) { }
/// <summary> /// Called after the client has accepted the WebSocket connection for |server| /// and |connection_id| via the OnWebSocketRequest callback. See /// OnWebSocketRequest documentation for intended usage. /// </summary> protected internal unsafe virtual void OnWebSocketConnected(CefServer server, int connectionId) { }
/// <summary> /// 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 cef_server_t::SendWebSocketMessage function after /// receiving the OnWebSocketConnected callback to respond with WebSocket /// messages. /// </summary> protected internal unsafe virtual void OnWebSocketRequest(CefServer server, int connectionId, string clientAddress, CefRequest request, CefCallback callback) { }
/// <summary> /// 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. /// </summary> protected internal unsafe virtual void OnClientDisconnected(CefServer server, int connectionId) { }
/// <summary> /// 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. /// </summary> protected internal unsafe virtual void OnHttpRequest(CefServer server, int connectionId, string clientAddress, CefRequest request) { }
/// <summary> /// 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. /// </summary> protected internal unsafe virtual void OnServerDestroyed(CefServer server) { }
/// <summary> /// 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. /// </summary> public unsafe virtual void OnServerCreated(CefServer server) { }
/// <summary> /// Called after the client has accepted the WebSocket connection for |server| /// and |connection_id| via the OnWebSocketRequest callback. See /// OnWebSocketRequest documentation for intended usage. /// </summary> public unsafe virtual void OnWebSocketConnected(CefServer server, int connectionId) { }
/// <summary> /// 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. /// </summary> public unsafe virtual void OnClientDisconnected(CefServer server, int connectionId) { }
/// <summary> /// 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. /// </summary> public unsafe virtual void OnServerDestroyed(CefServer server) { }