Runtime backend for shared multi-user sessions (e.g. an SSH chat served to many clients).
Wraps the Callback backend but routes app state changes through a
the shared-state server: when the app produces new state, it is pushed to
the shared server, which broadcasts {:shared_state_updated, state} to every connected
session. Each session merges its per-session mount_props over the shared state and
re-renders, so all clients stay in sync while keeping their own view-local props.
Selected per shared session at runtime, via the session's process dictionary, rather than by the app module. The same app can run standalone or shared.
Summary
Functions
Runs the app's handle_event/2 and pushes any new state to the shared server.
Runs the app's handle_event/3 and pushes any new state to the shared server.
The current shared state merged with this session's props.
Adopts a broadcast {:shared_state_updated, new_state} as this session's state.
Delegates to Drafter.Runtime.Callback.ready/2.
Delegates to Drafter.Runtime.Callback.refresh_rate/1.
Delegates to Drafter.Runtime.Callback.timer/3.
Functions
Runs the app's handle_event/2 and pushes any new state to the shared server.
The result is returned unchanged; only {:ok, state} and {:ok, state, actions}
trigger a broadcast.
Runs the app's handle_event/3 and pushes any new state to the shared server.
Broadcasts under the same conditions as handle_input/3.
The current shared state merged with this session's props.
With no shared-state server in the process dictionary, falls back to
Drafter.Runtime.Callback.mount/2. Where both carry a key, props wins.
Adopts a broadcast {:shared_state_updated, new_state} as this session's state.
This session's :drafter_mount_props are merged over the incoming state, so
view-local props survive a broadcast. Any other message delegates to
Drafter.Runtime.Callback.on_message/3.
Delegates to Drafter.Runtime.Callback.ready/2.
@spec refresh_rate(module()) :: Drafter.Runtime.refresh_rate()
Delegates to Drafter.Runtime.Callback.refresh_rate/1.
Delegates to Drafter.Runtime.Callback.scroll_active/2.
Delegates to Drafter.Runtime.Callback.scroll_idle/2.
Delegates to Drafter.Runtime.Callback.timer/3.
Timer results are not broadcast to other sessions.