How to Run SignalR service as a Server in Xamarin

Viewed 135

I have a requirement were I need to run SignalR server in Xamarin app, and consume it in web app. As far as I have seen in examples, Xamarin is used as a client consuming the SignalR. Can anyone help me how to register and start SignalR in Xamarin like we do in dotnet core app as below

services.AddSignalR();

app.UseSignalR(routes => {
   routes.MapHub<HubName>("path");
});

Is there a way were I can run same/alternative code in Xamarin. Thanks

1 Answers

Your above code, those are used in asp.net core webapp. What I currently know is that you can use SingalR Self-Host to achieve your needs, but it seems that .net core cannot be used, because the official documents are based on .net framework.

Official sample uses the console application, and this article uses windows service.

By using Microsoft.AspNet.SignalR.SelfHost package can achieve your needs.

Related