unit Module.Websocket;

interface

uses
  System.SysUtils, System.Classes, WEBLib.WebSocketClient, Web, WEBLib.Controls, WEBLib.Modules;

type
  TdmWebsocket = class(TWebDataModule)

  private
    procedure EMiMobileWebSocketClientConnect(Sender: TObject);
    procedure EMiMobileWebSocketClientDataReceived(Sender: TObject;
      Origin: string; SocketData: TJSObjectRecord);
    procedure EMiMobileWebSocketClientDisconnect(Sender: TObject);
    procedure EMiMobileWebSocketClientMessageReceived(Sender: TObject;
      AMessage: string);
    procedure EMiMobileWebSocketClientBinaryDataReceived(Sender: TObject;
      AData: TBytes);

  public
    EMiMobileWebSocketClient: TWebSocketClient;
    procedure DataModuleCreate(Sender: TObject);

  end;

var
  dmWebsocket: TdmWebsocket;

implementation

{%CLASSGROUP 'Vcl.Controls.TControl'}

{$R *.dfm}

procedure TdmWebsocket.DataModuleCreate(Sender: TObject);
begin

end;

procedure TdmWebsocket.EMiMobileWebSocketClientBinaryDataReceived(
  Sender: TObject; AData: TBytes);
begin
  console.log('EMiMobileWebSocketClientBinaryDataReceived');
end;

procedure TdmWebsocket.EMiMobileWebSocketClientConnect(Sender: TObject);
begin
  console.log('EMiMobileWebSocketClientConnect');
end;

procedure TdmWebsocket.EMiMobileWebSocketClientDataReceived(Sender: TObject;
  Origin: string; SocketData: TJSObjectRecord);
begin
  console.log('EMiMobileWebSocketClientDataReceived');
end;

procedure TdmWebsocket.EMiMobileWebSocketClientDisconnect(Sender: TObject);
begin
  console.log('EMiMobileWebSocketClientDisconnect');
end;

procedure TdmWebsocket.EMiMobileWebSocketClientMessageReceived(Sender: TObject;
  AMessage: string);
begin
  console.log('EMiMobileWebSocketClientMessageReceived');
end;

end.
