Skip to content

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.

License

Notifications You must be signed in to change notification settings

rkttu/WebsockifySharp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WebsockifySharp

NuGet Version NuGet Version Build Status GitHub Sponsors

A 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.

Minimum Requirements

  • Websockify: Requires a supported LTS version of .NET 6.0, .NET 8.0 as of May 2024. Also, It's ASP.NET middleware, so the Web SDK is a must-have.
    • Supported .NET Version: .NET 6.0, .NET 8.0
  • Unwebsockify: Requires a platform with .NET Standard 1.3 or later that can handle receiving and sending connections over TCP sockets.
    • Supported .NET Version: .NET Core 1.0+, .NET 5+, .NET Framework 4.6+, Mono 4.6+, UWP 10.0+, Unity 2018.1+

Usage

Websockify

// 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);

Unwebsockify

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);
}

Source code original author notice

License

This library follows Apache-2.0 license. See LICENSE file for more information.

About

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.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages