Question

I'm connecting to a signalR hub like this:

    $scope.starthubD = function() {
        $.connection.hub.start().done(function () {
            $.connection.HubName.server.method(sessionId);
        });
    };

I am receiving messages like this:

    $.connection.HubName.client.method= function(msg) {
        $scope.cars.push(msg);
    };

Through the hub, I am starting 10-12 long running threads:

public class ProcessHub: Hub
{
        IHubContext hubContext = GlobalHost.ConnectionManager.GetHubContext<ProcessHub>();

        new Thread(() => new Process(connectionId, hubContext)).Start();
        new Thread(() => new Process2(connectionId, hubContext)).Start();
        new Thread(() => new Process3(connectionId, hubContext)).Start();
}

The threads themselves directly report back to the client using:

hubContext.Clients.Client(connectionId).report(data);

The issue I am having is that it works most of the time, but sometimes I get disconnected with this message:

http://domain.se/signalr/connect?transport=serverSentEvents&connectionTok…weVsQoXvUzH&connectionData=%5B%7B%22name%22%3A%22carcompare%22%7D%5D&tid=7 net::ERR_CONNECTION_

Was it helpful?

Solution

I found out what the issues was. One of the threads were throwing an exception, making connection to the hub being lost.

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