0

I've got a few questions and problems regarding SignalR.

1st question:

I've downloaded signalr like this: npm install @aspnet/signalr according to Npmjs (v1.0.3). However, upon further inspection, my signalr files do not contain reconnect-functionality as can be found on the github:343 here. As a matter of fact, it seems like these are two different repos. Why do they differ, both seem to be developed by microsoft?

these are the two repos: https://github.com/SignalR/SignalR and https://github.com/aspnet/SignalR

2nd question:

I've tried to implement reconnect-functionality into my application with the limited functionality avaliable to me. This is my current approach (since i lack the reconnect-functions in the 1st repo) the code below produces this output on disconnect:

signalr.min.js:1353 Error: Connection disconnected with error 'Error: Server timeout elapsed without receiving a message from the server.'.

Uncaught TypeError: this.connect is not a function
at HubConnection.eval

trying to connect...
Uncaught TypeError: this.connect is not a function
at HubConnection.eval

trying to connect...
etc... etc...

Code:

this.connection.onclose(function (error) {
    if (!this.isConnected) {
        this.isConnected = false;
        appService.emit("disconnected", true);
        var intervalFunc = setInterval(function () {
            console.log("trying to connect...");
            this.connect();

            if (this.isConnected) {
                this.appService.emit("connected", true);
                this.isConnected = true;
                clearInterval(intervalFunc);
                console.log("connection established");
            }
        }.bind(this), 5000);
    }
});

I've also followed these resources in trying to implement reconnect-functionality:

Any help would be greatly appreciated.

Joel
  • 5,732
  • 4
  • 37
  • 65

1 Answers1

0

There is a .NET version and .NET CORE version. At the top of each of the github's you linked it shows: Incredibly simple real-time web for .NET (first github) and Incredibly simple real-time web for ASP.NET Core (second GitHub).

Your second question may come down to determining if you mixed up which SignalR product (.NET or .NET CORE) and the Clients for each. They are not cross compatible, so you cannot use the .NET JS Client with the Client for .NET Core.

I would recheck what you have implemented and go from there.

If you check the .NET Core repo under issues and search for reconnect, it does appear that reconnect is not a function any longer in .NET Core. See issue 1611.

Frank M
  • 1,379
  • 9
  • 18