-
Notifications
You must be signed in to change notification settings - Fork 535
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
R11s-driver: Add driver policy for long-polling downgrade #16051
R11s-driver: Add driver policy for long-polling downgrade #16051
Conversation
It would be great to add testing of both modes (long polling and websoclet) to a matrix of states we test in service tests. |
Terminology: Maybe it's fine as is, but technically it's not a downgrade, it's not allowing / not using websocket upgrade :) |
Actually it is a downgrade, right? Our default and first attempted connection is So, if "websocket" is considered an "upgrade" from "polling", then the reverse would be called a "downgrade", so this terminology would be accurate. |
I think that's a good idea. This PR still does not allow us to configure the driver to only perform From an actual user standpoint, I don't think we want to make that flow easily configurable, so adding a config just for testing feels a bit odd. Would be better to find a way to make the websocket transport fail consistently in a test environment. |
⯅ @fluid-example/bundle-size-tests: +30 Bytes
Baseline commit: 54cc669 |
If we look at HTTP protocol, then we failed to do websocket upgrade of HTTP connection, and now trying to leverage HTTP connection as is. You are probably right RE how that is exposed in socket.io - the ideal flow would be for socket.io not to close original http socket that failed websocket upgrade and reuse it. But I think it does not provide ability to express priorities around protocols, so we only list "websocket" protocol and if http upgrade to websocket failed, then whole http socket is closed and we start over with establishing new http socket. It's a bit wasteful and slow. You can see it even on example in https://socket.io/docs/v4/socket-io-protocol/#introduction - there is a request to upgrade to websocket:
Any chance you can look at it a bit more RE efficient way of using socket.io? Per https://github.com/socketio/engine.io-protocol#transports, it suggests that there might be more efficient way to deal with connections when websocket upgrade does not go through.
Maybe there is a way to establish first long polling connection, and then attempt to upgrade? And that sequence is as efficient to using "websocket" protocol from the starrt? |
This is the default socket.io behavior, but it was explicitly overwritten to do websocket first before I had even joined the project a few years ago. According to you, @vladsud, in #8820 discussion,
I'm inclined to keep the current functionality for now, since that is how it has been for years, and it doesn't seem like external sources that you've found are consistent on which is more performant. |
Description
Allow R11s-driver consumers to disable long-polling downgrade functionality.
Breaking Changes
The type for R11sDriverPolicies is adding a new config, but the param in DocumentServiceFactory uses
Partial<>
, so it is not actually breaking the usability.