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

a single ws connection per a window #1771

Merged
merged 2 commits into from
Apr 26, 2018
Merged

Conversation

akosyakov
Copy link
Member

@akosyakov akosyakov commented Apr 24, 2018

This PR should make sure that only one ws connection is used per a window. Fixes #1672

TODO:

@akosyakov
Copy link
Member Author

@svenefftinge It is still in the progress, but you can try it out.

svenefftinge
svenefftinge previously approved these changes Apr 25, 2018
Copy link
Contributor

@svenefftinge svenefftinge left a comment

Choose a reason for hiding this comment

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

Cool! Worked really well for me and the code looks good, too.

const { id } = message;
const channel = this.channels.get(id);
if (channel) {
channel.fireOpen();
Copy link
Contributor

Choose a reason for hiding this comment

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

we should at least log if there is a message without a channel

fireOpen: () => void = () => { };
onOpen(cb: () => void): void {
if (this.toDispose.disposed) {
return;
Copy link
Contributor

Choose a reason for hiding this comment

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

is registering callbacks on disposed channel not something we want at least log about? Maybe even throw an error?

protected handleConnection(socket: ws, request: http.IncomingMessage): void {
const pathname = request.url && url.parse(request.url).pathname;
if (pathname !== '/services') {
// TODO shoule we allow other ws connections?
Copy link
Contributor

Choose a reason for hiding this comment

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

should, but, yes, why not allowing multiple different websockets?

Signed-off-by: Anton Kosiakov <anton.kosyakov@typefox.io>
Signed-off-by: Anton Kosiakov <anton.kosyakov@typefox.io>
@akosyakov akosyakov changed the title WIP a single ws connection per a window a single ws connection per a window Apr 25, 2018
@akosyakov
Copy link
Member Author

akosyakov commented Apr 25, 2018

@svenefftinge I've addressed your comments and opened issues for remaining tasks. It is ready for the review.

@akosyakov akosyakov merged commit 2f94d08 into master Apr 26, 2018
@akosyakov akosyakov deleted the ak/single_ws_per_window branch April 26, 2018 05:11
@jopit jopit mentioned this pull request May 8, 2018
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

2 participants