Socket.IO Client
Connect to Socket.IO servers from Delphi/C++Builder. Speaks the Engine.IO transport plus the Socket.IO event/namespace layer with ACKs and rooms.
Connect to Socket.IO servers from Delphi/C++Builder. Speaks the Engine.IO transport plus the Socket.IO event/namespace layer with ACKs and rooms.
Client for the Socket.IO v3/v4 protocol — Engine.IO transport, namespaces, event emit/receive, ACK callbacks and binary attachments.
TsgcWSAPI_SocketIO
Windows, macOS, Linux, iOS, Android
Standard / Professional / Enterprise
Pair with TsgcWebSocketClient targeting /socket.io/ with EIO=4&transport=websocket — the component handles the Engine.IO handshake and lets you Emit / Subscribe events.
uses
sgcWebSocket, sgcWebSocket_API_SocketIO;
var
WSClient: TsgcWebSocketClient;
SIO: TsgcWSAPI_SocketIO;
begin
WSClient := TsgcWebSocketClient.Create(nil);
WSClient.URL := 'wss://server.example.com/socket.io/?EIO=4&transport=websocket';
SIO := TsgcWSAPI_SocketIO.Create(nil);
SIO.Client := WSClient;
WSClient.Active := True;
SIO.Emit('/', 'chat:message',
'{"user":"alice","text":"hello"}');
end;
// uses: sgcWebSocket, sgcWebSocket_API_SocketIO
TsgcWebSocketClient *WSClient = new TsgcWebSocketClient(this);
WSClient->URL = "wss://server.example.com/socket.io/?EIO=4&transport=websocket";
TsgcWSAPI_SocketIO *SIO = new TsgcWSAPI_SocketIO(this);
SIO->Client = WSClient;
WSClient->Active = true;
SIO->Emit("/", "chat:message",
"{\"user\":\"alice\",\"text\":\"hello\"}");
Implements both the Engine.IO transport layer (ping/pong, upgrade) and the Socket.IO message layer (CONNECT, EVENT, ACK, DISCONNECT) over a single TsgcWebSocketClient.
Handles the EIO=4 handshake, the 25-second ping/pong cadence and the protocol upgrade path. The component negotiates payload encoding (text or binary) automatically.
Connect(namespace) opens additional namespaces over the same transport. Emit(namespace, event, args) targets the chosen namespace; OnSocketIOEvent reports the originating namespace per event.
Pass a callback to Emit with an ACK identifier — when the server replies the component fires OnSocketIOAck with the matching id and the JSON arguments.
Socket.IO v4 supports interleaved binary payloads. The component preserves the placeholders and surfaces each attachment as a stream alongside the JSON envelope.
Bind the underlying TsgcWebSocketClient WatchDog to auto-reconnect — on reopen the component re-sends the CONNECT packets for every active namespace.
Socket.IO rooms are a server concept; the component participates by emitting join / leave events on whatever room contract your server defines.
Authoritative sources for the protocol this component implements.
Deep-link to the component reference, grab the ready-to-run demo project, and download the trial.
| Online Help — API_SocketIO Full property, method and event reference for this component. | Open | |
| Free Trial — sgcWebSockets Download the trial package and connect to Socket.IO servers from Delphi. | Open | |
| Technical Document (PDF) Features, quick start, code samples for Delphi & C++ Builder and primary-source references — this component only. | Open | |
| User Manual (PDF) Comprehensive manual covering every component in the library. | Open |