Hi Leonardo
If you have a single Escher process serving multiple requests and you want
to share some state between them, my recommendation would be to put the
shared data in signal, which can optionally be persisted to disk/DB
something like
if !isdefined(:my_global_var) # this condition makes sure all your UIs are
referring to the same variable
my_global_signal = Signal(Any, initial_value)
# you could also persist this to disk/DB for re-reading later, if you
have a function that can do that.
Reactive.foreach(save_to_disk, my_global_signal)
# optionally you could save throttle(1.0, my_global_signal) to make
sure the state is saved at most once every second so as to not hit the disk
often
end
function main(window)
# ... use my_global_signal here, to get and put updates: every client
will be notified of updates...
end
On Sun, Jan 31, 2016 at 5:47 PM, Leonardo <[email protected]> wrote:
> Hi all,
> I want write an application with a Web UI (e.g. a chat) that has a local
> state (specific for each client) and global one (a state bind to web
> server).
> These requirements are useful for example to permit communications between
> different client (e.g. into a chat) and/or handle centralized resources
> (like a DB connection shared by all client and created once into web
> server).
>
> How can I do that?
>
> Many thanks in advance
>
> Leonardo
>
>