Using SignalR with Azure Service Fabric

Can I use signalR with the Service Fabric provided by Microsoft? I am trying to connect a UWP application and an angularJS application to my reliable stateless service hosted in an azure cluster through a signalR / websocket connection. But both of them cannot open such a connection. On my local machine, everything is working fine.

Is there anything special to consider using signal / web cards with Service Fabric? Is there any example?

+4
source share
2 answers

You need to configure the load balancer on the client ip. Then the user will always refer to the same node and other users to other nodes. The user for the node relationship will be constant.

+5
source

You need to enable cross-domain settings for the signal in order to call it from other applications.

 appBuilder.Map("/signalr", map =>
        {

            map.UseCors(CorsOptions.AllowAll);
            var hubConfiguration = new HubConfiguration()
            {
                EnableJSONP = true,
                EnableDetailedErrors = true,
                EnableJavaScriptProxies  = true
            };

            map.RunSignalR(hubConfiguration);
        });

This code can be found in the readme.txt file that we get after installing the Nuget package for SignalR. For the cross-domain function, you also need to install the Cores nuget package.

After deploying this application, you can see that some signalR calls fail, and Some succeeds. By default, the number of instances in the Reliable Stateless service is -1. Thus, multiple instances will be created for the service.

signaleR Connection.Start() SingalR API. . API Service Fabric , , , , .

1 - . , .

+5

Source: https://habr.com/ru/post/1627735/


All Articles