TsgcWebSocketLoadBalancerServerProperties › LoadBalancer

LoadBalancer Property

Configures how the load balancer distributes downstream connections across registered backends and which protocols are balanced.

Syntax

property LoadBalancer: TsgcWSLoadBalancer_Options read FLoadBalancer write SetLoadBalancer;

Default Value

LoadBalancing=lbRandom, Protocols.WebSocket=True, Protocols.HTTP=True

Remarks

On TsgcWebSocketLoadBalancerServer the LoadBalancer property controls the runtime behaviour of the load balancer itself — it does not configure a client that registers against another load balancer (that role belongs to the same-named property on TsgcWebSocketServer). Backend TsgcWebSocketServer instances register by enabling their own LoadBalancer.Enabled and pointing LoadBalancer.Host/LoadBalancer.Port at this component; registration data is tracked internally in ServerList.

Sub-properties:

The binding that is returned to a new downstream client is whatever the chosen backend advertised through its own LoadBalancer.Bindings; the OnBeforeSendServerBinding event lets you override the selection just before it is sent.

Example


oServer := TsgcWebSocketLoadBalancerServer.Create(nil);
oServer.Port := 80;
oServer.LoadBalancer.LoadBalancing := lbConnections;
oServer.LoadBalancer.Protocols.WebSocket := true;
oServer.LoadBalancer.Protocols.HTTP := true;
oServer.Active := true;

Back to Properties