-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
[connection-status] Use Websockets #2222
Conversation
I am doing the review now... Please note, your connection-status tests have failed on the CIs. |
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 have added a few minor remarks. None of them are critical, they're rather cosmetic issues.
|
||
constructor( | ||
@inject(ConnectionStatusOptions) @optional() protected readonly options: ConnectionStatusOptions = ConnectionStatusOptions.DEFAULT, | ||
@inject(ILogger) protected readonly logger: ILogger | ||
) { | ||
this.statusChangeEmitter = new Emitter<ConnectionStatus>(); |
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.
Can you please switch to property injection then?
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 want to use it without injection (see mock-connection-service.ts)
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 see, then it makes sense. 👍
|
||
constructor( | ||
@inject(WebSocketConnectionProvider) protected readonly wsConnectionProvider: WebSocketConnectionProvider, | ||
@inject(PingService) protected readonly pingservice: PingService, |
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.
pingservice
-> pingService
please.
this.fireStatusChange(newState); | ||
} | ||
// schedule offline | ||
this.timer = this.setTimeout(async () => { |
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.
Unnecessary async
.
|
||
private scheduledPing: number | undefined; | ||
|
||
constructor( |
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.
Please use property injection.
Edited: Obsolete. See: #2222 (comment)
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.
see above
|
||
/** | ||
* Clients can listen on connection status change events. | ||
*/ | ||
readonly onStatusChange: Event<ConnectionStatus>; | ||
readonly onStatusChange: Event<ConnectionState>; |
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.
It should be onStateChange
.
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.
Also, updateStatus
and fireStatusChange
should be renamed to updateState
and fireStateChange
due to the ConnectionStatus
removal.
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 changed state
to status
Changed the connection status service to use websockets and natural activity. (fixes #1490) Signed-off-by: svenefftinge <sven.efftinge@typefox.io>
It works nicely. The tests are passing (locally) too. I have one more question; shouldn't we bind the |
There is no reason, it will be created once as it is requested only once. |
Alright, let's leave as is. |
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.
It works nicely. Thanks!
Changed the connection status service to use websockets
and natural activity. (fixes #1490)