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.

TsgcWSAPI_SocketIO

Client for the Socket.IO v3/v4 protocol — Engine.IO transport, namespaces, event emit/receive, ACK callbacks and binary attachments.

Component class

TsgcWSAPI_SocketIO

Platforms

Windows, macOS, Linux, iOS, Android

Edition

Standard / Professional / Enterprise

Drop, connect, emit, listen

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\"}");

What's inside

Implements both the Engine.IO transport layer (ping/pong, upgrade) and the Socket.IO message layer (CONNECT, EVENT, ACK, DISCONNECT) over a single TsgcWebSocketClient.

Engine.IO transport

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.

Namespaces

Connect(namespace) opens additional namespaces over the same transport. Emit(namespace, event, args) targets the chosen namespace; OnSocketIOEvent reports the originating namespace per event.

Event ACKs

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.

Binary attachments

Socket.IO v4 supports interleaved binary payloads. The component preserves the placeholders and surfaces each attachment as a stream alongside the JSON envelope.

Reconnection

Bind the underlying TsgcWebSocketClient WatchDog to auto-reconnect — on reopen the component re-sends the CONNECT packets for every active namespace.

Rooms (server-side)

Socket.IO rooms are a server concept; the component participates by emitting join / leave events on whatever room contract your server defines.

Specifications & references

Authoritative sources for the protocol this component implements.

Documentation & Demos

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.
Free Trial — sgcWebSockets Download the trial package and connect to Socket.IO servers from Delphi.
Technical Document (PDF) Features, quick start, code samples for Delphi & C++ Builder and primary-source references — this component only.
User Manual (PDF) Comprehensive manual covering every component in the library.

Ready to Talk to a Socket.IO Server?

Download the free trial and integrate Socket.IO into your Delphi applications.