They would get them by joining the room online_users and uid_UID

https://github.com/NodeBB/NodeBB/blob/73d4517d27c7f7b1de3d601b3cd4bde41c9178f2/src/socket.io/index.js#L79-L80