Socket.IO v4
Connect your Delphi applications to Socket.IO servers with full v4 protocol support, namespaces, and acknowledgements.
Connect your Delphi applications to Socket.IO servers with full v4 protocol support, namespaces, and acknowledgements.
A native Delphi client for Socket.IO v4 servers, supporting Engine.IO transport negotiation and all Socket.IO features.
The sgcWebSockets Socket.IO component implements the Socket.IO v4 protocol on top of Engine.IO, enabling Delphi applications to connect to any Socket.IO server. Emit and listen for events, join rooms via namespaces, and use acknowledgement callbacks for reliable communication.
Connect to a Socket.IO server and emit events.
uses
sgcWebSocket_API_SocketIO;
var
SocketIO: TsgcWebSocketAPI_SocketIO;
procedure TForm1.FormCreate(Sender: TObject);
begin
SocketIO := TsgcWebSocketAPI_SocketIO.Create(nil);
SocketIO.URL := 'https://myserver.com';
SocketIO.OnSocketIOEvent := OnEvent;
SocketIO.Connect;
end;
procedure TForm1.SendChat;
begin
SocketIO.Emit('chat message',
'"Hello from Delphi!"');
end;
procedure TForm1.OnEvent(Sender: TObject;
aNamespace, aEvent, aData: string);
begin
Memo1.Lines.Add(aEvent + ': ' + aData);
end;
Deep-link to the component reference, grab the ready-to-run demo project, and download the trial.