sessToForeground updates perUser online status accounting and fires due deferred notifications for the provided session.
(sess *Session)
| 863 | // sessToForeground updates perUser online status accounting and fires due |
| 864 | // deferred notifications for the provided session. |
| 865 | func (t *Topic) sessToForeground(sess *Session) { |
| 866 | s := sess |
| 867 | if s.multi != nil { |
| 868 | s = s.multi |
| 869 | } |
| 870 | |
| 871 | if pssd, ok := t.sessions[s]; ok && !pssd.isChanSub { |
| 872 | uid := pssd.uid |
| 873 | if s.isMultiplex() { |
| 874 | // If 's' is a multiplexing session, then sess is a proxy and it contains correct UID. |
| 875 | // Add UID to the list of online users. |
| 876 | uid = sess.uid |
| 877 | pssd.muids = append(pssd.muids, uid) |
| 878 | } |
| 879 | // Mark user as online |
| 880 | pud := t.perUser[uid] |
| 881 | pud.online++ |
| 882 | t.perUser[uid] = pud |
| 883 | |
| 884 | t.sendSubNotifications(uid, sess.sid, sess.userAgent) |
| 885 | } |
| 886 | } |
| 887 | |
| 888 | // Send immediate presence notification in response to a subscription. |
| 889 | // Send push notification to the P2P counterpart. |
no test coverage detected