Hi,
On my journey of exploring lustre server components, I came across the following scenario, where I would love some input and how to do this:
In the server I have some global state, that I would like to share and update with all clients (so all running server components).
To do this, the state is held by an actor that also uses glubsub (pubsub library) to Broadcast state updates to any process, that subscribed.
So when a new server component is created (in the lustre init function) I start a custom effect, that spawns a process which:
- Subscribes to the state updates using glubsub
- Calls dispatch whenever it receives an update to inform the server component of the update
So far, so good.
But what do I do when the server component stops?
I dont want the proces, that I started at init, to also exit.
But how can I do that? How do I "know" that the sever component has exited?
Thanks!