Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add websocket modes to dotnet-dsrouter #3461

Merged
merged 30 commits into from
Nov 15, 2022
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
d147761
Add "dsrouter server-websocket" command boilerplate
lambdageek Jul 12, 2022
cb2d059
WIP: server-websocket mode, now with web server
lambdageek Jul 13, 2022
a8f90c7
debug WriteLines
lambdageek Jul 13, 2022
f692c37
More WebSocketStreamAdapter work
lambdageek Jul 14, 2022
b5aabb8
fix comment
lambdageek Jul 15, 2022
7689a22
One more IWebSocketStreamAdapter dynamic cast
lambdageek Jul 18, 2022
19e62c4
remove debug WriteLines
lambdageek Jul 18, 2022
c4971df
update after rebase
lambdageek Oct 13, 2022
6f9897b
Move WebSocketServer bits to a separate assembly outside dotnet-dsrouter
lambdageek Oct 13, 2022
873adf0
fix up names
lambdageek Oct 13, 2022
50494ac
use a factory for creating WebSocketServer instances, instead of env var
lambdageek Oct 14, 2022
ac3d707
base class for TcpServerRouterFactory and WebSocketServerRouterFactory
lambdageek Oct 17, 2022
d42f90f
Remove IpcServerWebSocketServerRouterFactory
lambdageek Oct 17, 2022
b492e6d
Remove more copy/pasted code
lambdageek Oct 17, 2022
a2bffe8
Suppress generic host startup messages
lambdageek Oct 19, 2022
56d29e4
Factor out common run loop for dsrouter commands
lambdageek Oct 19, 2022
5e83757
Add client-webserver mode
lambdageek Oct 19, 2022
912f9ea
Remove development WriteLines
lambdageek Oct 20, 2022
8b4b856
Remove IpcWebSocketEndPointer class
lambdageek Oct 20, 2022
9260d0c
Pass LogLevel from dotnet-dsrouter to the webserver
lambdageek Oct 20, 2022
836fe65
Add comments, remove unused interface
lambdageek Oct 20, 2022
e0d928c
code organization cleanup
lambdageek Oct 20, 2022
45fd0aa
more comments
lambdageek Oct 20, 2022
11ad7b4
fix line damage
lambdageek Oct 20, 2022
5dca4f2
make the IWebSocketServer interface internal
lambdageek Oct 20, 2022
d18b37e
Fix formatting and whitespace
lambdageek Oct 28, 2022
5124c7f
Remove unnecessary logging
lambdageek Oct 28, 2022
958b3d4
Start/Stop the web server from the toplevel
lambdageek Oct 28, 2022
5b36507
Use net6.0 logging for dotnet-dsrouter
lambdageek Nov 15, 2022
f851bb3
fix help string for dsrouter client-websocket command
lambdageek Nov 15, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,13 @@ internal abstract class IpcServerTransport : IDisposable
private IIpcServerTransportCallbackInternal _callback;
private bool _disposed;

public static IpcServerTransport Create(string address, int maxConnections, bool enableTcpIpProtocol, IIpcServerTransportCallbackInternal transportCallback = null)
public static IpcServerTransport Create(string address, int maxConnections, ReversedDiagnosticsServer.Kind kind, IIpcServerTransportCallbackInternal transportCallback = null)
{
if (!enableTcpIpProtocol || !IpcTcpSocketEndPoint.IsTcpIpEndPoint(address))
if (kind == ReversedDiagnosticsServer.Kind.WebSocket)
{
return new IpcWebSocketServerTransport(address, maxConnections, transportCallback);
}
else if (kind == ReversedDiagnosticsServer.Kind.Ipc || !IpcTcpSocketEndPoint.IsTcpIpEndPoint(address))
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using System.IO;
using System.Threading;
using System.Threading.Tasks;

namespace Microsoft.Diagnostics.NETCore.Client;

internal sealed class IpcWebSocketServerTransport : IpcServerTransport
{
public IpcWebSocketServerTransport(string address, int maxAllowedConnections, IIpcServerTransportCallbackInternal transportCallback = null)
: base(transportCallback)
{
}

protected override void Dispose(bool disposing)
{
}

public override async Task<Stream> AcceptAsync(CancellationToken token)
{
WebSocketServer.IWebSocketServer server = WebSocketServer.WebSocketServerProvider.GetWebSocketServerInstance();
return await server.AcceptConnection(token);
}
}
Loading