TsgcWebSocketServer › Properties › Bindings
Collection of IP/Port pairs the server listens on; use it to bind several endpoints simultaneously.
property Bindings: TIdSocketHandles read GetBindings write SetBindings;
— (empty; server falls back to Port on all interfaces)
Add one entry per IP/Port combination the server must listen on. Each entry exposes IP, Port and IPVersion; when the collection is empty the server binds to every interface on Port. Use Bindings to serve both an HTTP and an HTTPS endpoint on the same component, or to restrict the server to one physical interface. Call Bindings.Clear() after stopping the server if you plan to reassign the listening endpoints before restarting.
oServer := TsgcWebSocketServer.Create(nil);
With oServer.Bindings.Add do
begin
IP := '127.0.0.1';
Port := 80;
end;
With oServer.Bindings.Add do
begin
IP := '127.0.0.1';
Port := 443;
end;
oServer.Active := true;