Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modified configurePingInterval to check if it is already set #2772

Merged
merged 2 commits into from Jan 4, 2014

Conversation

abnanda1
Copy link
Contributor

@@ -101,7 +101,7 @@
$(connection).triggerHandler(events.onError, [error]);
};

if (!config.pingIntervalId && config.pingInterval) {
if (!connection._.config && config.pingInterval) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be if (!connection._.pingIntervalId && config.pingInterval) { like Taylor wrote in the issue? #2739

@halter73
Copy link
Member

You should add a unit test for this ensuring the pingIntervalId doesn't change.

@davidfowl
Copy link
Member

I need this change yesterday.

@DamianEdwards
Copy link
Member

:shipit:

@davidfowl
Copy link
Member

I tried this fix on jabbr and it still fails when the connection is stopped and restarted with the following:

Uncaught TypeError: Cannot read property 'pingInterval' of undefined 

Seems like the connection._.config property is undefined.

@davidfowl
Copy link
Member

Ok this is an EPIC bug @NTaylorMullen thanks for the christmas gift :trollface:. So there's 2 issues, the one that @abnanda1 has fixed in this PR and another one that happens within the same area for completely different reasons:

When the connection is restarted, connection._.lastActiveAt isn't cleared, this causes restarted connections to run this logic on startup:

https://github.com/SignalR/SignalR/blob/release/src/Microsoft.AspNet.SignalR.Client.JS/jquery.signalR.transports.common.js#L448

Which in turns calls stop() and deletes all connection state. Here's what the log in jabbr looks:

[11:10:22 GMT-0800 (Pacific Standard Time)] SignalR: Websocket opened. jquery.signalR-2.1.0-pre-131129-b292.js:75
[11:10:22 GMT-0800 (Pacific Standard Time)] SignalR: Now monitoring keep alive with a warning timeout of 13333.333333333332 and a connection lost timeout of 20000. jquery.signalR-2.1.0-pre-131129-b292.js:75
[11:10:22 GMT-0800 (Pacific Standard Time)] SignalR: There has not been an active server connection for an extended period of time. Stopping connection. jquery.signalR-2.1.0-pre-131129-b292.js:75
[11:10:22 GMT-0800 (Pacific Standard Time)] SignalR: Stopping connection. jquery.signalR-2.1.0-pre-131129-b292.js:75
[11:10:22 GMT-0800 (Pacific Standard Time)] SignalR: Fired ajax abort async = true. jquery.signalR-2.1.0-pre-131129-b292.js:75
[11:10:22 GMT-0800 (Pacific Standard Time)] SignalR: Stopping the monitoring of the keep alive. jquery.signalR-2.1.0-pre-131129-b292.js:75
[11:10:22 GMT-0800 (Pacific Standard Time)] SignalR: Closing the Websocket. jquery.signalR-2.1.0-pre-131129-b292.js:75
[11:10:22 GMT-0800 (Pacific Standard Time)] SignalR: Dropped the connection from the server. Restarting in 5 seconds. jquery.signalR-2.1.0-pre-131129-b292.js:75
Uncaught TypeError: Cannot read property 'pingInterval' of undefined 

davidfowl added a commit to JabbR/JabbR that referenced this pull request Dec 24, 2013
@davidfowl
Copy link
Member

Patched in jabbr here JabbR/JabbR@101c9b6. Will open an issue for this in 2.0.2.

@@ -95,19 +95,6 @@
return connection.state === signalR.connectionState.disconnected;
},

configurePingInterval = function (connection) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did we move this? Testing?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup

@abnanda1
Copy link
Contributor Author

abnanda1 commented Jan 3, 2014

@davidfowl any more changes needed here?

abnanda1 added a commit that referenced this pull request Jan 4, 2014
abnanda1 added a commit that referenced this pull request Jan 4, 2014
@abnanda1 abnanda1 merged commit e6b3fbb into release Jan 4, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants