Load Balancer Server

TsgcWebSocketLoadBalancerServer — distribute WebSocket and HTTP connections across a pool of back-end servers using random or fewest-connections algorithms. Backup servers auto-register with the load balancer and stay connected through an optional auto-restart watchdog.

TsgcWebSocketLoadBalancerServer

Sticky-session-aware load balancer dedicated to sgcWebSockets backends. Backends register themselves through their built-in LoadBalancer property.

Component class

TsgcWebSocketLoadBalancerServer

Protocol

WebSocket / HTTP — RFC 6455

Platforms

Windows, macOS, Linux, iOS, Android

Edition

Enterprise

Drop the component, set a few properties, go

Drop a TsgcWebSocketLoadBalancerServer, bind a TLS port, point your backends at it.

uses
  sgcWebSocket_LoadBalancer_Server;

var
  LB: TsgcWebSocketLoadBalancerServer;
begin
  LB := TsgcWebSocketLoadBalancerServer.Create(nil);
  LB.Port := 443;
  LB.SSL := True;
  LB.SSLOptions.CertFile := 'server.pem';
  LB.SSLOptions.KeyFile  := 'server.key';

  // Each backend server registers itself by setting LoadBalancer on its own server component
  LB.OnServerConnect    := LBServerConnect;
  LB.OnServerDisconnect := LBServerDisconnect;

  LB.Active := True;
end;

What's inside

18 published properties, 9 methods, 22 events — pulled from the component reference.

Connection

Published properties: Active, Port, Bindings.

Messaging

Methods: Broadcast, WriteData, Ping.

Reliability

Published properties: LoadBalancer, FallBack.

Security

Published properties: SSL, SSLOptions, SecurityOptions.

Lifecycle

Events: OnConnect, OnDisconnect, OnHandshake.

Data

Events: OnMessage, OnBinary, OnFragmented.

Specifications & references

Authoritative sources for the protocols this component implements.

Documentation & Demos

Deep-link to the component reference, grab the ready-to-run demo project, and download the trial.

Online Help — TsgcWebSocketLoadBalancerServer Full property, method and event reference for this component.
Demo Project — 01.WebSocket\05.LoadBalancer Ready-to-run example project. Ships inside the sgcWebSockets package — download the trial below.
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.

Scale Out Your WebSocket Servers

Download the free trial and run sgcWebSockets behind a load balancer in minutes.