Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add websocket modes to dotnet-dsrouter (#3461)
* Add "dsrouter server-websocket" command boilerplate * More WebSocketStreamAdapter work add an interface for it in the Client library, and expose a way to check that it's conncted. * update after rebase * Move WebSocketServer bits to a separate assembly outside dotnet-dsrouter * use a factory for creating WebSocketServer instances, instead of env var * Remove IpcServerWebSocketServerRouterFactory Use IpcServerTcpServerRouterFactory since everything is sufficiently abstracted * Suppress generic host startup messages * Factor out common run loop for dsrouter commands * Add client-webserver mode In this mode the tracing command will start a domain socket and the runtime will connect to it: ``` dotnet trace collect --diagnostic-port /tmp/sock ``` Then ``` dotnet run --project src/Tools/dotnet-dsrouter -- client-websocket -ipcc /tmp/sock -ws http://localhost:8088/diagnostics ``` And finally launch the app in the browser http://localhost:8000 (or whatever you configured) In this mode, the app should be configured without suspending on startup ``` <WasmExtraConfig Include="environmentVariables" Value=' { "DOTNET_DiagnosticPorts": "ws://localhost:8088/diagnostics", }' /> ``` * Remove IpcWebSocketEndPointer class * Pass LogLevel from dotnet-dsrouter to the webserver * Add comments, remove unused interface * make the IWebSocketServer interface internal and IVT for Microsoft.Diagnostics.WebSocketServer that holds the implementation * Start/Stop the web server from the toplevel Instead of trying to start the webserver when the diagnostics code first calls AcceptConnection, just start the webserver when we start running, and stop it when the router is done. This also matches the expected use by WasmAppHost (`dotnet run`) which will start/stop the webserver itself, and we will just provide middleware for diagnostics * Use net6.0 logging for dotnet-dsrouter * fix help string for dsrouter client-websocket command Co-authored-by: Johan Lorensson <lateralusx.github@gmail.com>
- Loading branch information