Skip to content
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

Websocket for UI interactive refreshing #25661

Open
silverwind opened this issue Jul 3, 2023 · 8 comments
Open

Websocket for UI interactive refreshing #25661

silverwind opened this issue Jul 3, 2023 · 8 comments
Labels
topic/ui Change the appearance of the Gitea UI type/feature Completely new functionality. Can only be merged if feature freeze is not active. type/proposal The new feature has not been accepted yet but needs to be discussed first.

Comments

@silverwind
Copy link
Member

silverwind commented Jul 3, 2023

Feature Description

Currently we have Server-Sent-Events aka. EventSource for a few things but it's too unreliable because browser enforce a 6 connection limit per browser window and I think our implementation also has a number of unresolved bugs.

We should therefore switch EventSource to Websockets. From what I gather, suitable modules are:

For the frontend side, I recommend SharedWorker similar to this that can communicate "events" that are simple JSON messages to all open tabs. Could initially also be done on main thread because workers are a very hard to debug in browsers.

@silverwind silverwind added type/proposal The new feature has not been accepted yet but needs to be discussed first. type/feature Completely new functionality. Can only be merged if feature freeze is not active. topic/ui Change the appearance of the Gitea UI labels Jul 3, 2023
@delvh
Copy link
Member

delvh commented Jul 3, 2023

I think this issue exists already, the original even has a bounty if I remember correctly.

@silverwind
Copy link
Member Author

I couldn't find it earlier. If it exists, I'll add my comment there instead.

@techknowlogick
Copy link
Member

Ping @kdumontnu as I believe he was the one who put the bounty on it

@KN4CK3R
Copy link
Member

KN4CK3R commented Jul 4, 2023

This is the one with the bounty but we talk about a general refreshing.

@lunny
Copy link
Member

lunny commented Jul 4, 2023

We need a pub/sub abstract layer to replace modules/eventsource as backend of the websocket server side.

@silverwind
Copy link
Member Author

silverwind commented Jul 4, 2023

For distributed gitea setups a pub/sub mechanism is indeed necessary so that events originating on gitea instance 1 can propagate to clients connected on instance 2. Often this is done through redis, which would then make it a hard dependency, at least for distributed setups.

@lunny
Copy link
Member

lunny commented Jul 4, 2023

For distributed gitea setups a pub/sub mechanism is indeed necessary so that events originating on gitea instance 1 can propagate to clients connected on instance 2. Often this is done through redis, which would then make it a hard dependency, at least for distributed setups.

For single and default configuration, we can have a memory pub/sub implementation based on golang channel and a disk implementation.

@anbraten
Copy link
Contributor

linking #2287

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic/ui Change the appearance of the Gitea UI type/feature Completely new functionality. Can only be merged if feature freeze is not active. type/proposal The new feature has not been accepted yet but needs to be discussed first.
Projects
None yet
Development

No branches or pull requests

6 participants