-
Notifications
You must be signed in to change notification settings - Fork 2.7k
MM-32591: Reliable Websockets: Client side changes #7921
Conversation
We send connection_id and sequence_number as part of the query params. On receiving an event, we check if it's a hello packet, and if so, we inspect the connection_id sent with it. If it's different to what we have already, then we make the API calls and set sequence to 0. And if the sequence number is different to what we expect, then we just disconnect the connection, and expect the server to send from where we left off. ```release-note NONE ``` https://mattermost.atlassian.net/browse/MM-32591
client/websocket_client.tsx
Outdated
const MAX_WEBSOCKET_FAILS = 7; | ||
const MIN_WEBSOCKET_RETRY_TIME = 3000; // 3 sec | ||
const MAX_WEBSOCKET_RETRY_TIME = 300000; // 5 mins | ||
|
||
const reliableWebSockets = true; |
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 needs to be changed to actually take from the server config ServiceSettings.EnableReliableWebSockets
Hey @devinbinnie - I am handing this over to you. All that's needed is to actually take from the server config instead of a hardcoded boolean flag. There are 2 lint failures, but they might actually change when we change it to take from config. Feel free to polish it however way you feel. But the logic is all there, and does not need to change. |
@agnivade Alright I've setup the correct server config item to drive the use of reliable websockets. I also needed to make a change on the server branch One question: currently if the server changes the config item and the websocket drops, reconnection won't work properly until the webapp is refreshed. Are we okay with that or should we be trying to find something more robust to make sure the switch over is seamless. I don't see the case coming up very often outside of a server admin turning on the feature and rebooting the server, disconnecting everyone. |
Great question. Doesn't the webapp listen to config change events? If the admin changes the setting and reboots the server, the connection should try to reconnect and in the initialize function, |
Yes you're right, looks like it will call that again. |
Yeah, I am aware of that. I don't want to touch that at this point. It should be a proper exponential backoff. Will look into it once the basic implementation gets in. |
@agnivade Does this need QA review here or is that being done elsewhere? |
Yeah Saturn is doing it on the server PR. He will take all the branches. |
/update-branch |
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.
Tested and passed.
… MM-34128 * 'master' of github.com:mattermost/mattermost-webapp: (46 commits) Mm 27913 search channel tip (mattermost#6896) MM-35053 - cloud trial banner fixes (mattermost#7971) Fixing Zephyr keys for existing tests (mattermost#7977) Update NOTICE.txt (mattermost#7978) [MM-31934] Global policy form (mattermost#7816) MM-32591: Reliable Websockets: Client side changes (mattermost#7921) Translations update from Weblate (mattermost#7988) fix cloud onboarding tests (mattermost#7961) [MM-33428] remove check for Verify Signature (mattermost#7805) update compass icon font (mattermost#7965) [MM-35039] - Send trial ended email (mattermost#7967) Cypress/E2E: Fix tests related to email verification (mattermost#7960) Adding/fixing missing Zephyr keys and polishing tests (mattermost#7935) Mm 20425 migrate youtubevideo to typescript (mattermost#7786) MM-35074: short circuit slash command hooks (mattermost#7969) MM-34910 New messages toast should only count root posts (mattermost#7946) MM-31339: add e2e test for only one auto response per day (mattermost#7938) Cypress/E2E: Fix compliance export test (mattermost#7964) fix test related to channel switcher and bot display name (mattermost#7962) MM-34286: Adds missing authz checks. (mattermost#7891) ...
We send connection_id and sequence_number as part of the query params.
On receiving an event, we check if it's a hello packet, and if so,
we inspect the connection_id sent with it. If it's different to what
we have already, then we make the API calls and set sequence to 0.
And if the sequence number is different to what we expect, then
we just disconnect the connection, and expect the server to send
from where we left off.
https://mattermost.atlassian.net/browse/MM-32591