ever-co / ever-teams

Ever® Teams™ - Open Work and Project Management Platform - https://ever.team
https://ever.team
GNU Affero General Public License v3.0
252 stars 43 forks source link

[Feature] Implement real-time updates option #190

Open evereq opened 1 year ago

evereq commented 1 year ago

At the moment for v0.1.0 we will load (pull) data from Gauzy APIs periodically (e.g. every 0.5 sec) to update Team page and other details.

For v0.2.0 we want to implement more real-time updates (that will be default option for Cloud-based editions)

Please see https://github.com/ever-co/ever-gauzy/issues/1129 (section "Sync / p2p / CRDT / collaborative editing") for more libraries, some described below.

a) https://github.com/yjs/yjsm

b) Think https://logux.io might be very much relevant, see https://github.com/logux/server and https://github.com/logux/client.

c) https://github.com/ueberdosis/hocuspocus and https://tiptap.dev/hocuspocus d) https://github.com/partykit/partykit e) https://github.com/toeverything/AFFiNE, https://github.com/toeverything/BlockSuite, https://github.com/toeverything/OctoBase

f) Another interesting project (though not free) is https://replicache.dev. They have pretty good docs https://doc.replicache.dev/guide/remote-schema which possible can be used to build our custom backend for that and make more required updates inside Gauzy APIs to support such "push" from the server (using GraphQL subscriptions would be the best way I think, but possible other ways too). They have a good starter kit https://github.com/rocicorp/repliear (which is built with Supabase)

g) Another way is to use Pusher or a similar service. Especially interesting is https://pusher.com/docs/channels/using_channels/presence-channels which can be used to show "who is online". However note that our status color indicates not just that person online, but also WORKING (running timer). I think we will have to make improvements in UI, for example, we can still use a "green" circle when a person is online, but INSIDE that circle we can put a ">" (play) icon to indicate that person is not just online but also working now (tracking time now). Another way is to just change the shape of the figure from a circle to the ">" and keep the color green for those who track time now. So that online/offline information can be received quickly using "Presence channels" in Pusher, the same as working / not working (time off / on) can also be received in separate channels, and next it all merged when we display in UI.

h) we can also use https://github.com/electric-sql/electric and make it possible to replicate our PostgreSQL into local SQLite DB. See for example https://linear-lite.electric-sql.com (code in https://github.com/electric-sql/electric/tree/main/examples/linearlite and is based on https://github.com/tuan3w/linearapp_clone code)

i) https://github.com/pubkey/rxdb

I will do more research about the best way to make such real-time sync and update this ticket. Most probably solution would require making Gauzy APIs to be more "real-time" which we want to do in any case. However, the alternative way I see is the following:

This will allow us to make Gauzy Teams real-time much faster (hopefully).

Anishali2 commented 3 months ago

Sir, can I see this issue in depth?

Also, I see that if I disable the sync functionality it will not stop the apis calling

image

evereq commented 3 months ago

Hm, it suppose for sure to stop periodically sync calls to API, not sure what become broken, can you take a look @Anishali2 ? Create separate issue to check that, but please do NOT change any code, only research why it does not work that switch... Maybe when we improved some of methods related to that sync, we somehow broke that switch etc.