Reputation: 23
I am new to using Azure signalR service and I am kinda confused about something.
The thing is I am using a .Net 4.8 client and a javascript client with a self-hosted hub.
For the .net client this is the code:
using Microsoft.AspNet.SignalR.Client;
{
public class SignalRHub : ISignalRHub
{
private const string HubName = "Hub";
private readonly IHubProxy hub;
private readonly HubConnection connection;
public SignalRHub(string signalRUrl)
{
connection = new HubConnection(signalRUrl);
connection.StateChanged += Connection_StateChanged;
hub = connection.CreateHubProxy(HubName);
connection.Start().Wait();
}
private void Connection_StateChanged(StateChange obj)
{
...
}
public void Refreshed(string userId, string mId)
{
hub.Invoke("refreshed", uId, mId);
}
}
}
the signalRUrl is like this "http://localhost:8081/signalr"
The hub startup file is implemented as follows:
{
var hubConfiguration = new HubConfiguration
{
EnableDetailedErrors = true,
};
// Any connection or hub wire up and configuration should go here
app.MapSignalR("/signalr", hubConfiguration);
}
And this is the hub file
using Microsoft.AspNet.SignalR;
{
public class Hub: Hub
{
public void Refreshed(string userId, string mId )
{
Guid userIdAsGuid;
if (Guid.TryParse(userId, out userIdAsGuid))
{
Clients.Group(userId).Refresh(mId);
}
}
public void JoinGroup(string groupName)
{
Groups.Add(Context.ConnectionId, groupName);
}
}
}
The code above is working just fine and I have no problem with it. My issue is when I wanted to migrate to Azure SignalR service. I used this doc https://learn.microsoft.com/en-us/azure/azure-signalr/signalr-quickstart-dotnet
I changed the startup code to
app.MapAzureSignalR(this.GetType().FullName, hubConfiguration);
And I added the endpoints, and for the javascript client, I updated it to jquery.signalR-2.4.1 and it is working fine(sockets are being created)
However, for the .net client-side there was no indication whether to change and if it is really compatible with it.
So what I currently have is a half working application: the javascript side works and sends requests to the azure Signalr service (it can use JoinGroup) however there is no response and the .net client-side doesn't seem to be communicating with the hub(on Azure SignalR service platform no new clients are being added)
Since I am new to this concept I believe I might have missed some points probably due to a compatibilities issue, so I will be grateful for any clarification on this subject.
Thank you
Upvotes: 1
Views: 1137
Reputation: 23
So I figured out what was the issue it seems there were a package incompatibility between .net v4.7 and .net v4. I migrated all packages to following :
Thank you all for your help.
Upvotes: 1