TsgcWebSocketServer_HTTPAPI › Events › OnBeforeBinding
Fires before the server binds to the configured URL, so the list of bindings can be inspected or customized.
public event TsgcWSHTTPAPIBeforeBindingHandler OnBeforeBinding;
// delegate void TsgcWSHTTPAPIBeforeBindingHandler(TObject Sender, TStrings Bindings)
—
OnBeforeBinding is raised after the component has collected the URLs that will be registered with HTTP.SYS (from the Host/Port pair and from any entries added through Bindings.NewBinding) and before those URL prefixes are actually reserved. The Bindings parameter is the TStrings list of URL prefixes (for example "http://127.0.0.1:80/" or "https://+:443/"); clear, add or rewrite entries in this list to change which endpoints the kernel driver will listen on. This is the right place to inject per-environment bindings at runtime without touching the designer properties.
void OnBeforeBinding(TObject Sender, TStrings Bindings)
{
Bindings.Clear();
Bindings.Add("http://127.0.0.1:80/");
Bindings.Add("http://+:8080/api/");
}