Question

I am working on a site that uses signalr and it is working fine when i test it on my local machine but when a i try it remotely i cannot browse the mvc and when i try to send a request to signalar it just sits there waiting.

here is my javascript code (i am using angularjs but all that code works fine!):

function FixturesListController($scope,$q) {

$scope.fixtures =  [''];

var stringListHub = $.connection.stringListHub,
    model = {
        Items: []
    };
$.connection.hub.url = "http://192.168.1.2:8001/signalr";

stringListHub.client.updateModel = function(newName) {
    if (newName.Items != null) {
        $scope.$apply(function() {
            $scope.fixtures.length = 0;
            $(newName.Items).each(function(index, value) {
                $scope.fixtures.push(value);
            });
        });
    }


}

$.connection.hub.start({ xdomain: true }).done(function () {
    var fixtures = stringListHub.server.test().done(function (item) {
        $scope.$apply(function () {
            if (item.Items != null) {
                $scope.fixtures.length = 0;
                $(item.Items).each(function(index, value) {
                    $scope.fixtures.push(value);
                });
            }
        });
    });

});

$scope.AddFixture = function() {
    $scope.fixtures.push($scope.newName);
    stringListHub.server.updateModel({
        Items: $scope.fixtures
    });

};
}

Here is the signalr hub:

public class StringListHub : Hub
{
    private static StringList _list = new StringList();

    public void UpdateModel( StringList model )
    {
        _list = model;
        _list.LastUpdatedBy = Context.ConnectionId;
        // Update the shape model within our broadcaster
        Clients.AllExcept( _list.LastUpdatedBy ).updateModel( _list );
    }

    public StringList Test()
    {
        return _list;
    }
}

And i added this to my web.config

<system.webServer>
    <modules runAllManagedModulesForAllRequests="true">
    </modules>
</system.webServer>
Was it helpful?

Solution

I found out what the issue was. I was testing it on my own personal machine and iis has a restriction for the maximum number of concurrent connections to 3. So I ran it on windows server and it works fine.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top