TMS FNC WebSocket Server
TTMSFNCWebSocketServer is a headless component for hosting a WebSocket endpoint that accepts multiple simultaneous client connections and exchanges text or binary messages with them. It implements the RFC 6455 WebSocket protocol on top of an Indy HTTP server, serves each client on its own thread, and supports TLS-secured wss:// endpoints. Use it to push live data to browsers, apps, and devices from a VCL or FMX application.
Documentation
Start here
Use when
Get started
Install, configure, start a server, and handle your first client connection.
Guides
Task guides: running a server, broadcasting, connection data, connection health, and TLS.
API reference
Full property, method, and event reference.
Supported frameworks
Framework
Support
VCL
Win32 and Win64.
FMX
Windows, macOS, iOS, Android, and Linux.
TMS WEB Core
Not available; a browser cannot host a server.
Minimal example
Set a port and path, wire the connection events, and start listening:
Start a WebSocket server Pascal procedure TForm1.StartServer;
begin
FServer := TTMSFNCWebSocketServer.Create(Self);
FServer.Port := 5050; // default is 8888
FServer.PathName := 'chat'; // clients connect to ws://<host>:5050/chat
FServer.AutoSyncEvents := True; // raise events on the main thread
FServer.OnConnect := ServerConnect;
FServer.OnDisconnect := ServerDisconnect;
FServer.OnMessageReceived := ServerMessageReceived;
FServer.Active := True; // begin listening for clients
end;
procedure TForm1.StopServer;
begin
FServer.Active := False; // stop listening and drop all clients
end;
procedure TForm1.ServerConnect(Sender: TObject; AConnection: TTMSFNCWebSocketConnection);
begin
// A TCP connection arrived; the WebSocket handshake has not happened yet.
Log('Connection from ' + AConnection.PeerIP);
end;
procedure TForm1.ServerDisconnect(Sender: TObject; AConnection: TTMSFNCWebSocketConnection);
begin
Log('A client disconnected');
end;
API map
Guides
Area
Guide
Server lifecycle
Running a server — start and stop, port and path, accepting connections, lifecycle events, and event threads.
Messaging
Broadcasting messages — broadcasts, selector-based sends, relaying, frames, and removing clients.
Per-client state
Custom connection data — UserData, ownership, and routing on stored data.
Reliability
Connection health — ping, pong, close frames, and dropping dead clients.
Security
Secure connections — certificates, PFX conversion, and OpenSSL 3.x IO handlers.
See Also