How to iterate on all session belonging to the same user, or all tabs?

You must create a session group for each user, then iterate on all the sessions from this group, and possibly on all client processes for each session:

(* We get the session group state for this user: *)
  let state =