JsonHCS.Net.Proxies.SignalR
1.1.3
.NET 6.0
This package targets .NET 6.0. The package is compatible with this framework or higher.
.NET Standard 2.0
This package targets .NET Standard 2.0. The package is compatible with this framework or higher.
dotnet add package JsonHCS.Net.Proxies.SignalR --version 1.1.3
NuGet\Install-Package JsonHCS.Net.Proxies.SignalR -Version 1.1.3
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="JsonHCS.Net.Proxies.SignalR" Version="1.1.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add JsonHCS.Net.Proxies.SignalR --version 1.1.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: JsonHCS.Net.Proxies.SignalR, 1.1.3"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install JsonHCS.Net.Proxies.SignalR as a Cake Addin #addin nuget:?package=JsonHCS.Net.Proxies.SignalR&version=1.1.3 // Install JsonHCS.Net.Proxies.SignalR as a Cake Tool #tool nuget:?package=JsonHCS.Net.Proxies.SignalR&version=1.1.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
JsonHCS.Net.Proxies.SignalR
A simple JsonHCS.Net.Proxies plugin with strongly typed SignalR hub support.
Support
Supported platforms: .Net Standard 2.0+
Simple usage
Include the plugin from NuGet
Add the plugin to the proxy generator and construct the api
JsonHCSProxyGenerator pg = new JsonHCSProxyGenerator(null, new SignalRPlugin(), new BasicPlugin());
var api = pg.CreateClassProxy<API>("http://localhost:5000/");
- Include the plugin declaration in the API object with any or multiple of its usages:
public abstract class API
{
//Connect with strongly typed methods and Events
[Route("hub")]
public abstract Task<HubConnection<Client, Events>> Connect();
//Connect a plain HubConnection like normal SignalR
[Route("hub")]
public abstract Task<HubConnection> ConnectPlain();
//Connects and call the specified method
//implied: [HubMethod("Broadcast", SendType.Invoke)]
[HubMethod]
public abstract Task Broadcast(string text);
}
public interface Client
{
//Calls his method on the Hub, can be a shared interface to prevent mistakes!
Task Broadcast(string text);
}
public interface Events
{
//Triggers when "Receive" gets called from the Hub
event Func<string, Task> Receive;
//System.Reactive compatible IObservable gets updated when Receive gets called
//Only supports single argument calls for obvious reasons
[HubMethod("Receive")]
IObservable<string> Message { get; }
}
- Usage of HubConnection<,>:
var api = pg.CreateClassProxy<API>("http://localhost:5000/");
//Connects to the hub
var hub = await api.Connect();
//Use hub.On for events/observables
hub.On.Receive += ...;
var subscription = hub.On.Message.Subscribe(s => Console.WriteLine($"{DateTime.Now.TimeOfDay}: Subscription was updated to: {s}")));
//Use hub.Send or hub.Invoke to Send/Invoke to the hub
await hub.Send.Broadcast("Test 1");
Console.WriteLine($"{DateTime.Now.TimeOfDay}: Sending Test 2");
await hub.Send.Broadcast("Test 2");
Console.WriteLine($"{DateTime.Now.TimeOfDay}: Sending Test 3");
await hub.Send.Broadcast("Test 3");
Note: Any connection created will get cached and reused on multiple calls to prevent reconnecting.
A more complete sample can be found in the source.
Issues
Found an issue? Submit an issue!
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. 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 is compatible. 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 | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | 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 | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- JsonHCS.Net.Proxies (>= 1.8.2)
- Microsoft.AspNetCore.SignalR.Client (>= 8.0.8)
-
net6.0
- JsonHCS.Net.Proxies (>= 1.8.2)
- Microsoft.AspNetCore.SignalR.Client (>= 8.0.8)
-
net8.0
- JsonHCS.Net.Proxies (>= 1.8.2)
- Microsoft.AspNetCore.SignalR.Client (>= 8.0.8)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
-Added net6 and net8 targets
-Updated dependencies