-
Notifications
You must be signed in to change notification settings - Fork 447
Implement #1162 by adding client timeout for JavaScript #1163
Conversation
|
🆙 📅 Ready for review |
| send(data: any): Promise<void> { | ||
| return Promise.reject(""); | ||
| }, | ||
| type: TransportType.LongPolling, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't exist
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is this
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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 () { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
|
🆙 📅 clean-up |
| } | ||
|
|
||
| private processIncomingData(data: any) { | ||
| // For some reason, our TypeScript refs are set up for clearTimeout to take NodeJS.Timer... which is weird. |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
|
FYI, not merging this until #1161 is merged, as mentioned above. |
0dbda11 to
6d2b466
Compare
6d2b466 to
fa0ccb2
Compare
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