View Source EventStreamex.Events.LiveViewMonitor (EventStreamex v1.4.2)

This GenServer will monitor every LiveView of the current node when it uses EventListener. A LiveViewMonitor is started in each of your nodes.

When a LiveView exits, it will call EventStreamex.EventListener.unsubscribe_all/2 which will unsubscribe from all channels.

Summary

Functions

Returns a specification to start this module under a supervisor.

Monitors a LiveView given its pid, its module name and its state (only the subscriptions part).

Updates the state of the liveview specified by pid.

Functions

Link to this function

child_spec(init_arg)

View Source (since 1.4.1)

Returns a specification to start this module under a supervisor.

See Supervisor.

Link to this function

monitor(pid, view_module, view_state)

View Source (since 1.4.1)

Monitors a LiveView given its pid, its module name and its state (only the subscriptions part).

Only call this function when the liveview is connected to the socket

Link to this function

process_name()

View Source (since 1.4.1)
Link to this function

update_state(pid, view_state)

View Source (since 1.4.1)

Updates the state of the liveview specified by pid.

It's important to keep the subscriptions state up to date because it will be need when the process exits