A library that provides the ability to tunnel TCP socket connections to ASP.NET Core WebSockets and add a TCP socket bridge to your local environment.
$ dotnet add package WebsockifySharp.WebsockifyA library that provides the ability to tunnel TCP socket connections to ASP.NET Core WebSockets (Websockify) and add a TCP socket bridge (Unwebsockify) to your local environment.
// Specify the address and port number of the remote server with an open TCP listening socket that you want to relay the connection to.
var targetAddress = "127.0.0.1";
var targetPort = 8900;
var builder = WebApplication.CreateBuilder(args);
builder.WebHost.UseUrls("http://*:5000");
var app = builder.Build();
// Add the Websockify middleware to the application pipeline.
app.UseWebsockify("/websockify", targetAddress, targetPort);
await app.RunAsync(cancellationToken).ConfigureAwait(false);
var remoteWebSocketUrl = new Uri("ws://192.168.1.3:8900/websockify");
var localListenEndPoint = new IPEndPoint(IPAddress.Loopback, 13232);
using (var unwebsockify = new Unwebsockify(remoteWebSocketUrl, localListenEndPoint))
{
await unwebsockify.StartAsync().ConfigureAwait(false);
}