-
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
support persistent websocket #11499
support persistent websocket #11499
Conversation
for #11271 |
would you like to help review this @msujew @paul-marechal |
I think these kind of changes require a much more thorough explanation of how it works. I don't want to reverse engineer code to guess things like: How are connections identified? How are "backend sessions" persisted? How long may a session persist? Is there anything worth mentioning regarding the approach taken? I agree that the connection infrastructure is in need of more robustness, but please help us understand your solution. |
The reason for the unreliable message is that the message layer close the socket once the protected toIWebSocket(socket: Socket): IWebSocket {
return {
close: () => {
socket.removeAllListeners('disconnect');
socket.removeAllListeners('error');
socket.removeAllListeners('message');
socket.disconnect();
},
isConnected: () => socket.connected,
onClose: cb => socket.on('disconnect', reason => cb(reason)),
onError: cb => socket.on('error', error => cb(error)),
onMessage: cb => socket.on('message', data => cb(data)),
send: message => socket.emit('message', message)
};
} so if we do not close the socket at once and try to reconnect from frontend to backend, we can keep the message reliable. So we do as following:
So we build a |
packages/core/src/common/messaging/abstract-connection-provider.ts
Outdated
Show resolved
Hide resolved
Given the current |
that is why we could close other no-connected connections while some connection re-connect to stop waiting |
Signed-off-by: bob <bob170731@gmail.com>
c3871de
to
52d6807
Compare
Signed-off-by: bob <bob170731@gmail.com>
Hi, This change could help us a lot with disconnections issues since today after reconnecting all the plugins are reloaded/reactivated again and this takes a lot of time (e.g. RedHat Java plugins) also we have a vscode plugin that uses many webviews and custom editors that are fully reloaded cause bad UX. |
I'm happy to take another look at this PR.
I have to take a deeper look into this but I'm pretty confident that we can find a way to let us distinguish between graceful/intended websocket connection closes and actual connection loses. This way we could avoid leaking of backend-scoped containers on reload. @safisa |
@tortmayr I'm now away. But @FinnChen would continue to help it. |
Hi @tortmayr This disconnection can cause several issues, but I am not sure about all of them. I will try to mention the most annoying issues we faced:
Thanks |
Hi @DanboDuan, First thank you for this work in the PR. Thanks in advance |
I am not totally sure whether this is the right approach to resolving the issues that have been brought up. I agree that something needs fixing and I appreciate the work that went into this PR, but keeping the connection alive (and everything associated with it, like the plugin host) seems a bit heavy handed for me. I would much rather see a clean reconnection (including a restart of the plugin host) than trying to keep everything alive. I won't prevent other committers from reviewing/approving this PR, but I'm more inclined to close this to find another solution to the issues. Unless there are objections, I'll close this in the near future. |
Signed-off-by: bob bob170731@gmail.com
What it does
Support persistent websocket connection, which allow network to be weak and will not fire close event for shortly disconnected.
How to test
just open an ide in browser and fake network weakness by turning the computer with network-off mode, then turn on the network and the ide should continue to work fine.
Review checklist
Reminder for reviewers