VoileWeb.UserPresence (Voile v0.1.44)

Copy Markdown View Source

Tracks connected users across the application using ETS. Tracks all connections and separately counts authenticated users.

Entries are keyed by the LiveView socket PID and use a :set table, so reconnecting with the same PID overwrites the previous entry instead of accumulating duplicates. Dead entries are cleaned up lazily whenever stats are queried.

Summary

Functions

Remove the caller's entry from the presence table. Safe to call even if no entry exists.

Functions

get_connection_stats()

track_user(user)

untrack_user(pid \\ self())

Remove the caller's entry from the presence table. Safe to call even if no entry exists.