Delphi WebSocket Component — Production-Grade Client & Server
A native, RFC 6455 WebSocket implementation for Delphi and C++Builder. Build clients and servers that hold thousands of concurrent connections, run on Windows, macOS, Linux, iOS and Android, and survive flaky networks with the built-in WatchDog auto-reconnect.
A drop-in VCL/FMX component that turns the WebSocket protocol into a property-and-event API native Delphi developers recognise.
A Delphi WebSocket component is a non-visual component you drop on a form (or instantiate at runtime) to open a full-duplex TCP channel between a Delphi application and any RFC 6455 WebSocket peer — a browser, a Node.js service, an nginx reverse proxy, a Mosquitto broker, an OpenAI Realtime endpoint or another Delphi process. Unlike polling HTTP, a WebSocket keeps the connection open: the server can push data the moment it is available, with millisecond latency and no per-message HTTP overhead.
sgcWebSockets has been the reference WebSocket library in the Delphi ecosystem since 2013. The same TsgcWebSocketClient and TsgcWebSocketHTTPServer components run unchanged on Delphi 7 through Delphi 13, on Win32, Win64, Linux64, macOS, iOS and Android, and on C++Builder C2007 through C13. There is no managed runtime, no .NET interop layer, no JavaScript bridge — it is a pure Pascal implementation that compiles into your binary.
Writing one PING/PONG handler is easy. Surviving a TLS-terminating reverse proxy, an IIS WebSocket module, a corporate firewall, a mobile cellular handover and a 5,000-client load test is not.
One API, every transport
Plain WebSocket (ws://), TLS WebSocket (wss://), WebSocket over HTTP/2, WebSocket over QUIC/HTTP/3, raw TCP fallback — same component, same events. Switch transport by changing one property.
WatchDog auto-reconnect
Enable WatchDog and the client will reconnect with exponential back-off, re-authenticate, re-subscribe to MQTT topics and replay any queued publications — the canonical mobile / IoT pattern, already written.
Threading is solved
The server uses an IOCP / kqueue / epoll reactor under the hood. You write event handlers; the library schedules them across a thread pool with per-connection serialisation.
permessage-deflate
Negotiated automatically per RFC 7692. Cuts JSON payloads by 70–90 % and is supported by every modern browser and load balancer.
Sub-protocols included
MQTT 3.1.1/5.0, AMQP 0.9.1/1.0, STOMP, WAMP and Server-Sent Events ride on top of the same WebSocket transport — one TCP socket, multiple application protocols.
HTTP server, too
TsgcWebSocketHTTPServer serves static files, REST endpoints, JWT- and OAuth2-protected resources, gzip-compressed responses and HTTP/2 upgrade in the same process as your WebSocket endpoint.
TLS that actually works
OpenSSL (cross-platform), SChannel (Windows kernel TLS) or HTTP.sys. Client certificates, SNI, ALPN, TLS 1.3 with 0-RTT.
Channels & broadcast
Server-side Channels group connections by name. Broadcast, BroadcastByChannel and BroadcastByUser fan out to thousands of peers in a single call.
Battle-tested
In production at banks, exchanges, IoT fleets and trading firms since 2013. Updated every month; history.txt tracks every fix.
Feature matrix
Feature checklist
Everything the RFC says, plus the operational hardening real deployments need.
Server side is symmetric — drop a TsgcWebSocketHTTPServer, set Port, handle OnConnect and OnMessage, call Broadcast to fan out to every connected peer.
Compatibility
Supported Delphi & C++Builder versions
One source tree, 22 runtime packages — covering every Delphi release still in active commercial use.
Every commercial Delphi release from Delphi 7 (2002) through Delphi 13 (2025), plus matching C++Builder versions. We ship 22 separate runtime packages — one per IDE — from a single source tree. There is no separate “legacy” SKU; every customer gets every version.
Does the WebSocket component support TLS / wss://?
Yes. Set URL := 'wss://...' and pick a TLS provider: OpenSSL (cross-platform, ships with the trial), SChannel (Windows kernel TLS, no DLLs to deploy), or HTTP.sys (server-side, certificate stored in the Windows certificate store). Client certificates, SNI, ALPN, TLS 1.3 and 0-RTT are all supported.
How many concurrent connections can the server handle?
On Windows the server uses IOCP and routinely scales to 50,000+ concurrent connections per process on commodity hardware. On Linux the epoll reactor scales similarly. The hard limit is OS-level (file descriptors, ephemeral port range, kernel memory), not the library.
What is the licensing model?
Royalty-free per-developer perpetual licence with one year of updates included. Single-developer, team and site licences available — see pricing. Source code is included with every commercial edition.
Ready to add WebSockets to your Delphi app?
Download the fully-functional 30-day trial — client, server, all sub-protocols, all Delphi versions.