Skip to content

Conversation

rodja
Copy link
Member

@rodja rodja commented Oct 8, 2025

Motivation

Currently it's tricky to appreciate the Event demo 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:

Oct-08-2025 06-36-34

Progress

  • I chose a meaningful title that completes the sentence: "If applied, this PR will..."
  • The implementation is complete.
    • error handling, edge cases, ... there is still much much to do before it might be ready
  • Pytests have been added.
  • Documentation has been added.
    • example
    • link to example
    • info in documentaiton

@rodja
Copy link
Member Author

rodja commented Oct 8, 2025

It might even be possible to create a ZenohPersistentDict and hence allow a distributed storage without a seperate Redis server. But we should leave that for an other PR.

@evnchn
Copy link
Collaborator

evnchn commented Oct 8, 2025

Could also make https://nicegui.io/documentation/refreshable#global_scope work, where we faking it with the use of Event

But in another PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants