2017-12-18 19:38:56 +01:00
|
|
|
|
// ************************************************************************
|
|
|
|
|
// ***************************** CEF4Delphi *******************************
|
|
|
|
|
// ************************************************************************
|
|
|
|
|
//
|
2019-10-19 10:58:34 +02:00
|
|
|
|
// CEF4Delphi is based on DCEF3 which uses CEF to embed a chromium-based
|
2017-12-18 19:38:56 +01:00
|
|
|
|
// browser in Delphi applications.
|
|
|
|
|
//
|
|
|
|
|
// The original license of DCEF3 still applies to CEF4Delphi.
|
|
|
|
|
//
|
|
|
|
|
// For more information about CEF4Delphi visit :
|
|
|
|
|
// https://www.briskbard.com/index.php?lang=en&pageid=cef
|
|
|
|
|
//
|
2022-01-01 10:41:21 +01:00
|
|
|
|
// Copyright <20> 2022 Salvador Diaz Fau. All rights reserved.
|
2017-12-18 19:38:56 +01:00
|
|
|
|
//
|
|
|
|
|
// ************************************************************************
|
|
|
|
|
// ************ vvvv Original license and comments below vvvv *************
|
|
|
|
|
// ************************************************************************
|
|
|
|
|
(*
|
|
|
|
|
* Delphi Chromium Embedded 3
|
|
|
|
|
*
|
|
|
|
|
* Usage allowed under the restrictions of the Lesser GNU General Public License
|
|
|
|
|
* or alternatively the restrictions of the Mozilla Public License 1.1
|
|
|
|
|
*
|
|
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
|
|
|
|
* the specific language governing rights and limitations under the License.
|
|
|
|
|
*
|
|
|
|
|
* Unit owner : Henri Gourvest <hgourvest@gmail.com>
|
|
|
|
|
* Web site : http://www.progdigy.com
|
|
|
|
|
* Repository : http://code.google.com/p/delphichromiumembedded/
|
|
|
|
|
* Group : http://groups.google.com/group/delphichromiumembedded
|
|
|
|
|
*
|
|
|
|
|
* Embarcadero Technologies, Inc is not permitted to use or redistribute
|
|
|
|
|
* this source code without explicit permission.
|
|
|
|
|
*
|
|
|
|
|
*)
|
|
|
|
|
|
|
|
|
|
unit uCEFServerHandler;
|
|
|
|
|
|
2018-05-12 14:50:54 +02:00
|
|
|
|
{$IFDEF FPC}
|
|
|
|
|
{$MODE OBJFPC}{$H+}
|
|
|
|
|
{$ENDIF}
|
|
|
|
|
|
2017-12-18 19:38:56 +01:00
|
|
|
|
{$I cef.inc}
|
|
|
|
|
|
2022-02-19 18:56:41 +01:00
|
|
|
|
{$IFNDEF TARGET_64BITS}{$ALIGN ON}{$ENDIF}
|
|
|
|
|
{$MINENUMSIZE 4}
|
|
|
|
|
|
2017-12-18 19:38:56 +01:00
|
|
|
|
interface
|
|
|
|
|
|
|
|
|
|
uses
|
|
|
|
|
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes;
|
|
|
|
|
|
|
|
|
|
type
|
|
|
|
|
TCEFServerHandlerOwn = class(TCefBaseRefCountedOwn, ICefServerHandler)
|
|
|
|
|
protected
|
|
|
|
|
procedure OnServerCreated(const server: ICefServer); virtual;
|
|
|
|
|
procedure OnServerDestroyed(const server: ICefServer); virtual;
|
|
|
|
|
procedure OnClientConnected(const server: ICefServer; connection_id: Integer); virtual;
|
|
|
|
|
procedure OnClientDisconnected(const server: ICefServer; connection_id: Integer); virtual;
|
|
|
|
|
procedure OnHttpRequest(const server: ICefServer; connection_id: Integer; const client_address: ustring; const request: ICefRequest); virtual;
|
|
|
|
|
procedure OnWebSocketRequest(const server: ICefServer; connection_id: Integer; const client_address: ustring; const request: ICefRequest; const callback: ICefCallback); virtual;
|
|
|
|
|
procedure OnWebSocketConnected(const server: ICefServer; connection_id: Integer); virtual;
|
|
|
|
|
procedure OnWebSocketMessage(const server: ICefServer; connection_id: Integer; const data: Pointer; data_size: NativeUInt); virtual;
|
|
|
|
|
|
|
|
|
|
public
|
|
|
|
|
constructor Create; virtual;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
TCustomServerHandler = class(TCEFServerHandlerOwn)
|
|
|
|
|
protected
|
2020-03-29 17:31:42 +02:00
|
|
|
|
FEvents : Pointer;
|
2017-12-18 19:38:56 +01:00
|
|
|
|
|
|
|
|
|
procedure OnServerCreated(const server: ICefServer); override;
|
|
|
|
|
procedure OnServerDestroyed(const server: ICefServer); override;
|
|
|
|
|
procedure OnClientConnected(const server: ICefServer; connection_id: Integer); override;
|
|
|
|
|
procedure OnClientDisconnected(const server: ICefServer; connection_id: Integer); override;
|
|
|
|
|
procedure OnHttpRequest(const server: ICefServer; connection_id: Integer; const client_address: ustring; const request: ICefRequest); override;
|
|
|
|
|
procedure OnWebSocketRequest(const server: ICefServer; connection_id: Integer; const client_address: ustring; const request: ICefRequest; const callback: ICefCallback); override;
|
|
|
|
|
procedure OnWebSocketConnected(const server: ICefServer; connection_id: Integer); override;
|
|
|
|
|
procedure OnWebSocketMessage(const server: ICefServer; connection_id: Integer; const data: Pointer; data_size: NativeUInt); override;
|
|
|
|
|
|
|
|
|
|
public
|
|
|
|
|
constructor Create(const events: IServerEvents); reintroduce;
|
|
|
|
|
destructor Destroy; override;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
|
|
|
|
uses
|
2018-02-03 17:52:48 +01:00
|
|
|
|
{$IFDEF DELPHI16_UP}
|
|
|
|
|
System.SysUtils,
|
|
|
|
|
{$ELSE}
|
|
|
|
|
SysUtils,
|
|
|
|
|
{$ENDIF}
|
2017-12-18 19:38:56 +01:00
|
|
|
|
uCEFMiscFunctions, uCEFLibFunctions, uCEFServer, uCEFRequest, uCEFCallback;
|
|
|
|
|
|
|
|
|
|
// **************************************************************
|
|
|
|
|
// ******************** TCEFServerHandlerOwn ********************
|
|
|
|
|
// **************************************************************
|
|
|
|
|
|
2018-03-29 20:02:04 +02:00
|
|
|
|
procedure cef_server_handler_on_server_created(self : PCefServerHandler;
|
|
|
|
|
server : PCefServer); stdcall;
|
|
|
|
|
var
|
|
|
|
|
TempObject : TObject;
|
2017-12-18 19:38:56 +01:00
|
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
|
TempObject := CefGetObject(self);
|
|
|
|
|
|
|
|
|
|
if (TempObject <> nil) and (TempObject is TCEFServerHandlerOwn) then
|
|
|
|
|
TCEFServerHandlerOwn(TempObject).OnServerCreated(TCEFServerRef.UnWrap(server));
|
2017-12-18 19:38:56 +01:00
|
|
|
|
end;
|
|
|
|
|
|
2018-03-29 20:02:04 +02:00
|
|
|
|
procedure cef_server_handler_on_server_destroyed(self : PCefServerHandler;
|
|
|
|
|
server : PCefServer); stdcall;
|
|
|
|
|
var
|
|
|
|
|
TempObject : TObject;
|
2017-12-18 19:38:56 +01:00
|
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
|
TempObject := CefGetObject(self);
|
|
|
|
|
|
|
|
|
|
if (TempObject <> nil) and (TempObject is TCEFServerHandlerOwn) then
|
|
|
|
|
TCEFServerHandlerOwn(TempObject).OnServerDestroyed(TCEFServerRef.UnWrap(server));
|
2017-12-18 19:38:56 +01:00
|
|
|
|
end;
|
|
|
|
|
|
2018-03-29 20:02:04 +02:00
|
|
|
|
procedure cef_server_handler_on_client_connected(self : PCefServerHandler;
|
|
|
|
|
server : PCefServer;
|
|
|
|
|
connection_id : Integer); stdcall;
|
|
|
|
|
var
|
|
|
|
|
TempObject : TObject;
|
2017-12-18 19:38:56 +01:00
|
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
|
TempObject := CefGetObject(self);
|
|
|
|
|
|
|
|
|
|
if (TempObject <> nil) and (TempObject is TCEFServerHandlerOwn) then
|
|
|
|
|
TCEFServerHandlerOwn(TempObject).OnClientConnected(TCEFServerRef.UnWrap(server),
|
|
|
|
|
connection_id);
|
2017-12-18 19:38:56 +01:00
|
|
|
|
end;
|
|
|
|
|
|
2018-03-29 20:02:04 +02:00
|
|
|
|
procedure cef_server_handler_on_client_disconnected(self : PCefServerHandler;
|
|
|
|
|
server : PCefServer;
|
|
|
|
|
connection_id : Integer); stdcall;
|
|
|
|
|
var
|
|
|
|
|
TempObject : TObject;
|
2017-12-18 19:38:56 +01:00
|
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
|
TempObject := CefGetObject(self);
|
|
|
|
|
|
|
|
|
|
if (TempObject <> nil) and (TempObject is TCEFServerHandlerOwn) then
|
|
|
|
|
TCEFServerHandlerOwn(TempObject).OnClientDisconnected(TCEFServerRef.UnWrap(server),
|
|
|
|
|
connection_id);
|
2017-12-18 19:38:56 +01:00
|
|
|
|
end;
|
|
|
|
|
|
2018-03-29 20:02:04 +02:00
|
|
|
|
procedure cef_server_handler_on_http_request( self : PCefServerHandler;
|
|
|
|
|
server : PCefServer;
|
|
|
|
|
connection_id : Integer;
|
|
|
|
|
const client_address : PCefString;
|
|
|
|
|
request : PCefRequest); stdcall;
|
|
|
|
|
var
|
|
|
|
|
TempObject : TObject;
|
2017-12-18 19:38:56 +01:00
|
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
|
TempObject := CefGetObject(self);
|
|
|
|
|
|
|
|
|
|
if (TempObject <> nil) and (TempObject is TCEFServerHandlerOwn) then
|
|
|
|
|
TCEFServerHandlerOwn(TempObject).OnHttpRequest(TCEFServerRef.UnWrap(server),
|
|
|
|
|
connection_id,
|
|
|
|
|
CefString(client_address),
|
|
|
|
|
TCefRequestRef.UnWrap(request));
|
2017-12-18 19:38:56 +01:00
|
|
|
|
end;
|
|
|
|
|
|
2018-03-29 20:02:04 +02:00
|
|
|
|
procedure cef_server_handler_on_web_socket_request( self : PCefServerHandler;
|
|
|
|
|
server : PCefServer;
|
|
|
|
|
connection_id : Integer;
|
|
|
|
|
const client_address : PCefString;
|
|
|
|
|
request : PCefRequest;
|
|
|
|
|
callback : PCefCallback); stdcall;
|
|
|
|
|
var
|
|
|
|
|
TempObject : TObject;
|
2017-12-18 19:38:56 +01:00
|
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
|
TempObject := CefGetObject(self);
|
|
|
|
|
|
|
|
|
|
if (TempObject <> nil) and (TempObject is TCEFServerHandlerOwn) then
|
|
|
|
|
TCEFServerHandlerOwn(TempObject).OnWebSocketRequest(TCEFServerRef.UnWrap(server),
|
|
|
|
|
connection_id,
|
|
|
|
|
CefString(client_address),
|
|
|
|
|
TCefRequestRef.UnWrap(request),
|
|
|
|
|
TCefCallbackRef.UnWrap(callback));
|
2017-12-18 19:38:56 +01:00
|
|
|
|
end;
|
|
|
|
|
|
2018-03-29 20:02:04 +02:00
|
|
|
|
procedure cef_server_handler_on_web_socket_connected(self : PCefServerHandler;
|
|
|
|
|
server : PCefServer;
|
|
|
|
|
connection_id : Integer); stdcall;
|
|
|
|
|
var
|
|
|
|
|
TempObject : TObject;
|
2017-12-18 19:38:56 +01:00
|
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
|
TempObject := CefGetObject(self);
|
|
|
|
|
|
|
|
|
|
if (TempObject <> nil) and (TempObject is TCEFServerHandlerOwn) then
|
|
|
|
|
TCEFServerHandlerOwn(TempObject).OnWebSocketConnected(TCEFServerRef.UnWrap(server),
|
|
|
|
|
connection_id);
|
2017-12-18 19:38:56 +01:00
|
|
|
|
end;
|
|
|
|
|
|
2018-03-29 20:02:04 +02:00
|
|
|
|
procedure cef_server_handler_on_web_socket_message( self : PCefServerHandler;
|
|
|
|
|
server : PCefServer;
|
|
|
|
|
connection_id : Integer;
|
|
|
|
|
const data : Pointer;
|
|
|
|
|
data_size : NativeUInt); stdcall;
|
|
|
|
|
var
|
|
|
|
|
TempObject : TObject;
|
2017-12-18 19:38:56 +01:00
|
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
|
TempObject := CefGetObject(self);
|
|
|
|
|
|
|
|
|
|
if (TempObject <> nil) and (TempObject is TCEFServerHandlerOwn) then
|
|
|
|
|
TCEFServerHandlerOwn(TempObject).OnWebSocketMessage(TCEFServerRef.UnWrap(server),
|
|
|
|
|
connection_id,
|
|
|
|
|
data,
|
|
|
|
|
data_size);
|
2017-12-18 19:38:56 +01:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
constructor TCEFServerHandlerOwn.Create;
|
|
|
|
|
begin
|
|
|
|
|
inherited CreateData(SizeOf(TCEFServerHandler));
|
|
|
|
|
|
|
|
|
|
with PCEFServerHandler(FData)^ do
|
|
|
|
|
begin
|
2018-05-12 14:50:54 +02:00
|
|
|
|
on_server_created := {$IFDEF FPC}@{$ENDIF}cef_server_handler_on_server_created;
|
|
|
|
|
on_server_destroyed := {$IFDEF FPC}@{$ENDIF}cef_server_handler_on_server_destroyed;
|
|
|
|
|
on_client_connected := {$IFDEF FPC}@{$ENDIF}cef_server_handler_on_client_connected;
|
|
|
|
|
on_client_disconnected := {$IFDEF FPC}@{$ENDIF}cef_server_handler_on_client_disconnected;
|
|
|
|
|
on_http_request := {$IFDEF FPC}@{$ENDIF}cef_server_handler_on_http_request;
|
|
|
|
|
on_web_socket_request := {$IFDEF FPC}@{$ENDIF}cef_server_handler_on_web_socket_request;
|
|
|
|
|
on_web_socket_connected := {$IFDEF FPC}@{$ENDIF}cef_server_handler_on_web_socket_connected;
|
|
|
|
|
on_web_socket_message := {$IFDEF FPC}@{$ENDIF}cef_server_handler_on_web_socket_message;
|
2017-12-18 19:38:56 +01:00
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TCEFServerHandlerOwn.OnServerCreated(const server: ICefServer);
|
|
|
|
|
begin
|
|
|
|
|
//
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TCEFServerHandlerOwn.OnServerDestroyed(const server: ICefServer);
|
|
|
|
|
begin
|
|
|
|
|
//
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TCEFServerHandlerOwn.OnClientConnected(const server: ICefServer; connection_id: Integer);
|
|
|
|
|
begin
|
|
|
|
|
//
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TCEFServerHandlerOwn.OnClientDisconnected(const server: ICefServer; connection_id: Integer);
|
|
|
|
|
begin
|
|
|
|
|
//
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TCEFServerHandlerOwn.OnHttpRequest(const server: ICefServer; connection_id: Integer; const client_address: ustring; const request: ICefRequest);
|
|
|
|
|
begin
|
|
|
|
|
//
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TCEFServerHandlerOwn.OnWebSocketRequest(const server: ICefServer; connection_id: Integer; const client_address: ustring; const request: ICefRequest; const callback: ICefCallback);
|
|
|
|
|
begin
|
|
|
|
|
//
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TCEFServerHandlerOwn.OnWebSocketConnected(const server: ICefServer; connection_id: Integer);
|
|
|
|
|
begin
|
|
|
|
|
//
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TCEFServerHandlerOwn.OnWebSocketMessage(const server: ICefServer; connection_id: Integer; const data: Pointer; data_size: NativeUInt);
|
|
|
|
|
begin
|
|
|
|
|
//
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
// ************************************************************************
|
|
|
|
|
// ************************* TCustomServerHandler *************************
|
|
|
|
|
// ************************************************************************
|
|
|
|
|
|
|
|
|
|
constructor TCustomServerHandler.Create(const events: IServerEvents);
|
|
|
|
|
begin
|
|
|
|
|
inherited Create;
|
|
|
|
|
|
2020-03-29 17:31:42 +02:00
|
|
|
|
FEvents := Pointer(events);
|
2017-12-18 19:38:56 +01:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
destructor TCustomServerHandler.Destroy;
|
|
|
|
|
begin
|
|
|
|
|
FEvents := nil;
|
|
|
|
|
|
|
|
|
|
inherited Destroy;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TCustomServerHandler.OnServerCreated(const server: ICefServer);
|
|
|
|
|
begin
|
2018-02-03 17:52:48 +01:00
|
|
|
|
try
|
2020-03-29 17:31:42 +02:00
|
|
|
|
if (FEvents <> nil) then
|
|
|
|
|
IServerEvents(FEvents).doOnServerCreated(server);
|
2018-02-03 17:52:48 +01:00
|
|
|
|
except
|
|
|
|
|
on e : exception do
|
|
|
|
|
if CustomExceptionHandler('TCustomServerHandler.OnServerCreated', e) then raise;
|
|
|
|
|
end;
|
2017-12-18 19:38:56 +01:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TCustomServerHandler.OnServerDestroyed(const server: ICefServer);
|
|
|
|
|
begin
|
2018-02-03 17:52:48 +01:00
|
|
|
|
try
|
2020-03-29 17:31:42 +02:00
|
|
|
|
if (FEvents <> nil) then
|
|
|
|
|
IServerEvents(FEvents).doOnServerDestroyed(server);
|
2018-02-03 17:52:48 +01:00
|
|
|
|
except
|
|
|
|
|
on e : exception do
|
|
|
|
|
if CustomExceptionHandler('TCustomServerHandler.OnServerDestroyed', e) then raise;
|
|
|
|
|
end;
|
2017-12-18 19:38:56 +01:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TCustomServerHandler.OnClientConnected(const server: ICefServer; connection_id: Integer);
|
|
|
|
|
begin
|
2018-02-03 17:52:48 +01:00
|
|
|
|
try
|
2020-03-29 17:31:42 +02:00
|
|
|
|
if (FEvents <> nil) then
|
|
|
|
|
IServerEvents(FEvents).doOnClientConnected(server, connection_id);
|
2018-02-03 17:52:48 +01:00
|
|
|
|
except
|
|
|
|
|
on e : exception do
|
|
|
|
|
if CustomExceptionHandler('TCustomServerHandler.OnClientConnected', e) then raise;
|
|
|
|
|
end;
|
2017-12-18 19:38:56 +01:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TCustomServerHandler.OnClientDisconnected(const server: ICefServer; connection_id: Integer);
|
|
|
|
|
begin
|
2018-02-03 17:52:48 +01:00
|
|
|
|
try
|
2020-03-29 17:31:42 +02:00
|
|
|
|
if (FEvents <> nil) then
|
|
|
|
|
IServerEvents(FEvents).doOnClientDisconnected(server, connection_id);
|
2018-02-03 17:52:48 +01:00
|
|
|
|
except
|
|
|
|
|
on e : exception do
|
|
|
|
|
if CustomExceptionHandler('TCustomServerHandler.OnClientDisconnected', e) then raise;
|
|
|
|
|
end;
|
2017-12-18 19:38:56 +01:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TCustomServerHandler.OnHttpRequest(const server: ICefServer; connection_id: Integer; const client_address: ustring; const request: ICefRequest);
|
|
|
|
|
begin
|
2018-02-03 17:52:48 +01:00
|
|
|
|
try
|
2020-03-29 17:31:42 +02:00
|
|
|
|
if (FEvents <> nil) then
|
|
|
|
|
IServerEvents(FEvents).doOnHttpRequest(server, connection_id, client_address, request);
|
2018-02-03 17:52:48 +01:00
|
|
|
|
except
|
|
|
|
|
on e : exception do
|
|
|
|
|
if CustomExceptionHandler('TCustomServerHandler.OnHttpRequest', e) then raise;
|
|
|
|
|
end;
|
2017-12-18 19:38:56 +01:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TCustomServerHandler.OnWebSocketRequest(const server: ICefServer; connection_id: Integer; const client_address: ustring; const request: ICefRequest; const callback: ICefCallback);
|
|
|
|
|
begin
|
2018-02-03 17:52:48 +01:00
|
|
|
|
try
|
2020-03-29 17:31:42 +02:00
|
|
|
|
if (FEvents <> nil) then
|
|
|
|
|
IServerEvents(FEvents).doOnWebSocketRequest(server, connection_id, client_address, request, callback);
|
2018-02-03 17:52:48 +01:00
|
|
|
|
except
|
|
|
|
|
on e : exception do
|
|
|
|
|
if CustomExceptionHandler('TCustomServerHandler.OnWebSocketRequest', e) then raise;
|
|
|
|
|
end;
|
2017-12-18 19:38:56 +01:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TCustomServerHandler.OnWebSocketConnected(const server: ICefServer; connection_id: Integer);
|
|
|
|
|
begin
|
2018-02-03 17:52:48 +01:00
|
|
|
|
try
|
2020-03-29 17:31:42 +02:00
|
|
|
|
if (FEvents <> nil) then
|
|
|
|
|
IServerEvents(FEvents).doOnWebSocketConnected(server, connection_id);
|
2018-02-03 17:52:48 +01:00
|
|
|
|
except
|
|
|
|
|
on e : exception do
|
|
|
|
|
if CustomExceptionHandler('TCustomServerHandler.OnWebSocketConnected', e) then raise;
|
|
|
|
|
end;
|
2017-12-18 19:38:56 +01:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TCustomServerHandler.OnWebSocketMessage(const server: ICefServer; connection_id: Integer; const data: Pointer; data_size: NativeUInt);
|
|
|
|
|
begin
|
2018-02-03 17:52:48 +01:00
|
|
|
|
try
|
2020-03-29 17:31:42 +02:00
|
|
|
|
if (FEvents <> nil) then
|
|
|
|
|
IServerEvents(FEvents).doOnWebSocketMessage(server, connection_id, data, data_size);
|
2018-02-03 17:52:48 +01:00
|
|
|
|
except
|
|
|
|
|
on e : exception do
|
|
|
|
|
if CustomExceptionHandler('TCustomServerHandler.OnWebSocketMessage', e) then raise;
|
|
|
|
|
end;
|
2017-12-18 19:38:56 +01:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
end.
|