This is a client for websocket connection in Delphi.
[Optional]
For ease I recommend using the Boss for installation
- Boss - Dependency Manager for Delphi
boss install github.com/mateusvicente100/websocket-client
Add the following folder to your project, in Project > Options > Resource Compiler > Directories and Conditionals > Include file search path
../bird-socket-client/src
You need to use WebSocket.Client
uses Bird.Socket.Client;
Create an instance of TWebSocketClient and assign the propertys and events listeners
procedure Start;
var
LBirdSocket: TBirdSocketClient;
begin
LBirdSocket := TBirdSocketClient.New('ws://localhost:8080');
LBirdSocket.AddEventListener(TEventType.MESSAGE,
procedure(const AText: string)
begin
Log(AText);
end);
LBirdSocket.Connect;
LBirdSocket.Send('Hello Server');
end;
Check out our sample project for the Delphi bird sokect client connection. If you have any questions or suggestion, please contact, make your pull request or create an issue.