-
-
Notifications
You must be signed in to change notification settings - Fork 902
Make Event sync between instances in distributed setups #5231
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
base: main
Are you sure you want to change the base?
Conversation
|
It might even be possible to create a |
|
Could also make https://nicegui.io/documentation/refreshable#global_scope work, where we faking it with the use of But in another PR. |
|
https://chatgpt.com/share/68f0d6ca-6f5c-800c-8d4c-2f7abbda6632 I wonder if the topic should be generated differently. In particular, I think events that are generated from a library like rosys would always result in the same topic right now. I am not sure if it is worth considering this in the current state, but I wanted to leave a note here. |
|
Good point, @NiklasNeugebauer. Definitely worth checking. I'm wondering if we really should add the code for distributed events into the @rodja, you probably want a global switch Maybe we need to think about specific real-world applications to answer such questions about the desired API. Since this PR is only a draft, there's no urge in answering them now. I just wanted to leave my thoughts here for reference. |
Yes @falkoschindler. Feels great and keeps the responsibilities apart.
You are right @NiklasNeugebauer. It would be better to incorporate the app which is running into the auto-generated topic. Maybe the app title is unique enough in combination with the existing logic? Of course it should also be possible to optionally define your own topic string. |
|
I think some manually set instance id would be useful so that a user does not have to define every event topic but is still able to differentiate the instances (by version, specific application, whatever). |
Motivation
Currently it's tricky to appreciate the
Eventdemo in the documentation: when sending a "tweet" it only appears on visitors of the same instance. Due to the distributed deployment via fly.io, if a user opens two tabs, they have a high chance of landing on different instances.Implementation
This PR is currently just an (AI-aided) sketch of an idea I had after some research. By using Zenoh to transparently sync events across instances. Zenoh is great for this because it does not need a broker or seperate server (like MQTT or Redis). Instances simply auto-discorver. To test it, I created a new example called
distributed: A docker swarm starts three NiceGUI instances and a Traefik proxy in front:Progress