Websockets.WebSocket4Net
1.0.3
dotnet add package Websockets.WebSocket4Net --version 1.0.3
NuGet\Install-Package Websockets.WebSocket4Net -Version 1.0.3
<PackageReference Include="Websockets.WebSocket4Net" Version="1.0.3" />
paket add Websockets.WebSocket4Net --version 1.0.3
#r "nuget: Websockets.WebSocket4Net, 1.0.3"
// Install Websockets.WebSocket4Net as a Cake Addin
#addin nuget:?package=Websockets.WebSocket4Net&version=1.0.3
// Install Websockets.WebSocket4Net as a Cake Tool
#tool nuget:?package=Websockets.WebSocket4Net&version=1.0.3
Websockets.Standard
Websockets.Standard is a .Net Standard class library that wraps around different WebSocket implementations.
This project originated from WebSocket.PCL
Feel free to make an issue/pull request to support more library's/platforms
Platforms
- Android (Native coming soon)
- IOS (SocketRocket coming soon)
- UWP
- .NET Framework (2.0 and up)
- .NET Standard/Core (1.3 and up)
WP8(dropped because silverlight is not .net standard/VS 2017 compatible)
NuGet
- Websockets.Standard (include in your library/common app)
- .NET (.Net 4.5+, Standard 1.3+, Universal)
- WebSocket4Net (.Net Standard 1.3+, mono, .NET 2.0+)
Advantages
With Websocket.Standard you can easily switch between implementations per platform or even at runtime!! Don't know wich websocket to use? Just try them one-by-one by changing one line and see wich suits you best! Are you missing a common websocket library, make an issue and tell us which you need!
Usage
void Configure()
{
// Call in your specific platform startup
// 1) Link at startup before socket creation
Websockets.Net.WebsocketConnection.Link();
}
void Connect()
{
// 2) Get a websocket from the standard library via the factory
connection = Websockets.WebSocketFactory.Create();
connection.OnOpened += Connection_OnOpened;
connection.OnMessage += Connection_OnMessage;
}
void Send()
{
connection.Open("http://echo.websocket.org");
connection.Send("Hello World");
}
private void Connection_OnOpened()
{
Debug.WriteLine("Opened !");
}
private void Connection_OnMessage(string obj)
{
Echo = obj == "Hello World";
}
Special Setups
.NET Standard/PCL library
- Include the Websockets.Standard library only, and don't link anything leave that to the platforms to choose
Xamarin Forms
- Include the Websockets.Standard library in the main common app
- Include the platform specific library in the platform projects
Windows 8 Phone
- Fork or download source
- Change Websocket4Net version to add silverlight support and compile with VS 2015
- Include Websockets.Websocket4Net and Websockets.Standard library
Example
There are a few 'test' examples (projects with the Tests suffix). Take a look there. They use a common library, the platforms just include the library and link the right implementation.
TODO
- Support multiple factories/implementation in one app
- Support Native Android (port from old project)
- Support Ios SocketRocket (port from old project)
- Support other platforms/libraries.
Questions?
Make an issue and i will try answer asap.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp1.0 was computed. netcoreapp1.1 was computed. netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard1.3 is compatible. netstandard1.4 was computed. netstandard1.5 was computed. netstandard1.6 was computed. netstandard2.0 was computed. netstandard2.1 was computed. |
.NET Framework | net20 is compatible. net35 is compatible. net40 is compatible. net403 was computed. net45 is compatible. net451 was computed. net452 was computed. net46 was computed. net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen30 was computed. tizen40 was computed. tizen60 was computed. |
Universal Windows Platform | uap was computed. uap10.0 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 2.0
- WebSocket4Net (>= 0.15.1)
- Websockets.Standard (>= 1.0.2)
-
.NETFramework 3.5
- WebSocket4Net (>= 0.15.1)
- Websockets.Standard (>= 1.0.2)
-
.NETFramework 4.0
- WebSocket4Net (>= 0.15.1)
- Websockets.Standard (>= 1.0.2)
-
.NETFramework 4.5
- WebSocket4Net (>= 0.15.1)
- Websockets.Standard (>= 1.0.2)
-
.NETStandard 1.3
- NETStandard.Library (>= 1.6.1)
- WebSocket4Net (>= 0.15.1)
- Websockets.Standard (>= 1.0.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Added more supported platforms for WebSocket4Net