TsgcWebSocketProxyServer › Properties › Bindings
Collection of IP/Port pairs the proxy listens on for incoming downstream WebSocket clients.
property Bindings: TIdSocketHandles read GetBindings write SetBindings;
— (empty; proxy falls back to Port on all interfaces)
Add one entry per IP/Port combination the proxy must listen on. Each entry exposes IP, Port and IPVersion; when the collection is empty the proxy binds to every interface on Port. Use Bindings to expose both a plain and a TLS endpoint from the same proxy instance while forwarding all traffic to the single upstream server defined in Proxy, or to restrict the proxy to one physical interface. Call Bindings.Clear() after stopping the proxy if you plan to reassign the listening endpoints before restarting.
oProxy := TsgcWebSocketProxyServer.Create(nil);
With oProxy.Bindings.Add do
begin
IP := '127.0.0.1';
Port := 80;
end;
With oProxy.Bindings.Add do
begin
IP := '127.0.0.1';
Port := 443;
end;
oProxy.Proxy.Host := 'upstream.example.com';
oProxy.Proxy.Port := 8080;
oProxy.Active := true;