Skip to content
This repository was archived by the owner on Dec 18, 2018. It is now read-only.

Conversation

@analogrelay
Copy link
Contributor

@analogrelay analogrelay commented Nov 28, 2017

Add client timeout to JS client. It is configurable via an option and defaults to 30 seconds (the server ping rate defaults to 15 seconds, so this is effectively 2 server ping intervals).

NOTE: Should not be merged until #1161 is merged since it will immediately break any connection that goes idle for 30 seconds :).

Fixes #1162

@analogrelay analogrelay changed the title very rough js client timeout implementation Implement #1162 by adding client timeout for JavaScript Nov 28, 2017
@analogrelay
Copy link
Contributor Author

🆙 📅 Ready for review

send(data: any): Promise<void> {
return Promise.reject("");
},
type: TransportType.LongPolling,
Copy link
Member

Choose a reason for hiding this comment

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

This doesn't exist

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, old code, not cleaned up :). Thanks!

connect(url: string, requestedTransferMode: TransferMode): Promise<TransferMode> { return Promise.resolve(transportTransferMode); },
send(data: any): Promise<void> { return Promise.resolve(); },
stop(): void {},
type: TransportType.LongPolling,
Copy link
Member

Choose a reason for hiding this comment

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

same

type: TransportType.LongPolling,
onreceive: null,
onclose: null,
mode: transportTransferMode
Copy link
Member

Choose a reason for hiding this comment

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

Remove this too

class TestConnection implements IConnection {
readonly features: any = {};

transportType: TransportType = TransportType.LongPolling;
Copy link
Member

Choose a reason for hiding this comment

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

Don't think this exists

import { asyncit as it, captureException } from './JasmineUtils';
import { asyncit as it, captureException, delay, PromiseSource } from './Utils';
import { IHubConnectionOptions } from "../Microsoft.AspNetCore.SignalR.Client.TS/IHubConnectionOptions";
import { connect } from "tls";
Copy link
Member

Choose a reason for hiding this comment

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

what is this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

VSCode being overly "helpful" and trying to import things I accidentally choose in Intellisense

});
});

if(transportType != signalR.TransportType.LongPolling) {
Copy link
Member

Choose a reason for hiding this comment

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

nit: space

import { HubConnection } from "../Microsoft.AspNetCore.SignalR.Client.TS/HubConnection"
import { DataReceived, ConnectionClosed } from "../Microsoft.AspNetCore.SignalR.Client.TS/Common"
import { TransportType, ITransport, TransferMode } from "../Microsoft.AspNetCore.SignalR.Client.TS/Transports"
import { TransportType, ITransport, TransferMode, LongPollingTransport } from "../Microsoft.AspNetCore.SignalR.Client.TS/Transports"
Copy link
Member

Choose a reason for hiding this comment

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

revert

fail(e);
done();
});
.then(function () {
Copy link
Member

Choose a reason for hiding this comment

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

I liked the old indentation

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's the VSCode auto-formatter at work :(.

let guidBytes = [];
for (let i = 0; i < value.GUID.length; i++) {
guidBytes.push(value.GUID.charCodeAt(i));
.then(function (value) {
Copy link
Member

Choose a reason for hiding this comment

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

Same here

@analogrelay
Copy link
Contributor Author

🆙 📅 clean-up

}

private processIncomingData(data: any) {
// For some reason, our TypeScript refs are set up for clearTimeout to take NodeJS.Timer... which is weird.
Copy link
Member

Choose a reason for hiding this comment

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

Is this a concern for us?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, I figured this out and it's intentional. This time around we're building our JS client as a NodeJS library and using Browserify to polyfill, rather than as a browser library, so we do want to use the NodeJS timer pattern.

@analogrelay
Copy link
Contributor Author

FYI, not merging this until #1161 is merged, as mentioned above.

@analogrelay analogrelay force-pushed the anurse/1162-js-client-timeout branch from 0dbda11 to 6d2b466 Compare December 4, 2017 18:39
@analogrelay analogrelay force-pushed the anurse/1162-js-client-timeout branch from 6d2b466 to fa0ccb2 Compare December 5, 2017 00:19
@analogrelay analogrelay merged commit f4bb309 into dev Dec 5, 2017
@analogrelay analogrelay deleted the anurse/1162-js-client-timeout branch December 13, 2017 00:39
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants