How to prevent multiple presence registrations using Phoenix.Presence?

I inspect my Presence.list("room:clients") and see something like this sometimes:

 "client:edward" => %{
    metas: [
      %{
        online_at: 1587238274,
        phx_ref: "JhqAROu/paI=",
        version: "1.2.0.5"
      },
      %{
        online_at: 1587238274,
        phx_ref: "Zc535KMM9Xs=",
        version: "1.2.0.5"
      }
    ]
  }

My question, what does this mean, how to prevent it and have only one Presence registration by user?

This means that that person has your site open in two tabs or two browser windows. Each is a distinct presence. You don’t generally want to prevent this.

3 Likes