ASP.NET Core 2.2.0-preview1: SignalR Java Client
This post was authored by Mikael Mengistu.
In ASP.NET Core 2.2 we are introducing a Java Client for SignalR. The first preview of this new client is available now. This client supports connecting to an ASP.NET Core SignalR Server from Java code, including Android apps.
The HubConnection is initialized the same way, with the
Just like in the .NET client, we can send an invocation using the send method.
Handlers for server invocations can be registered using the
on method. One major difference here is that the argument types must be specified as parameters, due to differences in how Java handles generics.
Installing the Java Client
If you’re using Gradle you can add the following line to your
If you’re using Maven you can add the following lines to the dependencies section of your
For a complete sample, see https://github.com/aspnet/SignalR-samples/tree/master/AndroidJavaClient
This is an early preview release of the Java client so there are many features that are not yet supported. We plan to close all these gaps before the RTM release:
- Only primitive types can be accepted as parameters and return types.
- The APIs are synchronous.
- Only the “Send” call type is supported at this time, “Invoke” and streaming return values are not supported.
- The client does not currently support the Azure SignalR Service.
- Only the JSON protocol is supported.
- Only the WebSockets transport is supported.