TsgcWebSocketProxyServer › Methods › ReStart
Stops and then restarts the proxy server from a secondary thread, useful after changing bindings, ports, or the upstream target at runtime.
procedure ReStart;
ReStart chains a Stop followed by a Start inside an internal worker thread, so the caller is not blocked while existing WebSocket connections and their paired upstream TCP links are closed and bindings reopened. It is the recommended way to apply configuration changes that require the proxy to re-bind its sockets at runtime, such as changing the listening Port, adjusting Bindings, or redirecting traffic to a different Proxy backend. The OnShutdown event fires once the old listener stops, and OnStartup fires again once the new listener is accepting connections. When changing Port or Bindings, call Bindings.Clear after stopping so the old bindings are not reused.
oServer.Port := 8080;
oServer.ReStart();