Agniva De Sarker cd4d322e4a MM-32950: Reliable WebSockets: Basic single server (#17406)
* MM-32950: Reliable WebSockets: Basic single server

This PR adds reliable websocket support for a single server.

Below is a brief overview of the three states of a connection:

Normal:
- All messages are routed via web hub.
- Each web conn has a send queue to which it gets pushed.
- A message gets pulled from the queue, and before it
gets written to the wire, it is added to the dead queue.

Disconnect:
- Hub Unregister gets called, where the connection is just
marked as inactive. And new messages keep getting pushed
to the send queue.

If it gets full, the channel is closed and the conn gets removed
from conn index.

Reconnect:
- We query the hub for the connection ID, and get back the
queues.
- We construct a WebConn reusing the old queues, or a fresh one
depending on whether the connection ID was found or not.
- Now there is a tricky bit here which needs to be carefully processed.
On register, we would always send the hello message in the send queue.
But we cannot do that now because the send queue might already have messages.

Therefore, we don't send the hello message from web hub, if we reuse a connection.

Instead, we move that logic to the web conn write pump. We check if
the sequence number is in dead queue, and if it is, then we drain
the dead queue, and start consuming from the active queue.
No hello message is sent here.

But if the message does not exist in the dead queue, and the sequence number
is actually something that should have existed, then we set
a new connction id and clear the dead queue, and send a hello message.
The client, on receiving a new connection id will automatically
set its sequence number to 0, and make the sync API calls to manage
any lost data.

https://mattermost.atlassian.net/browse/MM-32590

```release-note
NONE
```

* gofmt

* Add EnableReliableWebSockets to the client config

* Refactoring isInDeadQueue

* Passing index to drainDeadQueue

* refactoring webconn

* fix pointer

* review comments

* simplify hasMsgLoss

* safety comment

* fix test

* Trigger CI

* Trigger CI

Co-authored-by: Devin Binnie <devin.binnie@mattermost.com>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-04-26 19:51:25 +05:30
2021-04-26 16:17:52 +02:00
2021-01-04 15:21:01 +01:00
2021-03-05 09:18:37 +01:00
2020-01-23 12:34:29 +01:00
2021-04-22 17:48:09 -04:00
2021-04-23 15:28:01 +02:00
2021-03-12 12:37:30 -05:00
2021-03-05 09:18:37 +01:00
2020-03-13 18:35:31 +01:00
2019-04-04 09:49:07 -04:00
2021-01-14 18:21:21 +01:00
2021-03-17 18:18:32 +01:00
2018-05-30 10:23:25 -04:00
2021-04-26 16:17:52 +02:00
2021-01-22 19:40:37 +01:00

Mattermost

Mattermost is an open source, private cloud, Slack-alternative from https://mattermost.com.

It's written in Golang and React and runs as a single Linux binary with MySQL or PostgreSQL. Every month on the 16th a new compiled version is released under an MIT license.

screenshot at nov 29 14-11-32

Table of Contents

Try out Mattermost

Deploy on Heroku

Deploy a Preview

Note: Heroku preview does not include email or persistent storage

Deploy on a Cloud Platform via Bitnami

Auto-deploy Mattermost to Amazon Web Services, Azure, Google Cloud Platform, or Oracle Cloud Platform via Bitnami.

Install on Your Own Machine

Native Mobile and Desktop Apps

In addition to the web interface, you can also download Mattermost clients for Android, iOS, Windows PC, Mac OSX, and Linux.

Google Play App Store Windows PC Mac OSX Linux

Get Security Bulletins

Receive notifications of critical security updates. The sophistication of online attackers is perpetually increasing. If you are deploying Mattermost it is highly recommended you subscribe to the Mattermost Security Bulletin mailing list for updates on critical security releases.

Get Involved

Learn More

License

See the LICENSE file for license rights and limitations.

Get the Latest News

Contributing

Please see CONTRIBUTING.md.

Any other questions, mail us at info@mattermost.com. Wed love to meet you!

Description
Mattermost is an open source platform for secure collaboration across the entire software development lifecycle..
Readme 1.2 GiB
Languages
TypeScript 46.9%
Go 40.2%
JavaScript 8.6%
SCSS 2.8%
HTML 1.1%
Other 0.3%