Sunday, March 20, 2011

How can anonymous users exchange presence information with valid users on Jabber (Ejabberd)


I am working on a social network that should allow members to chat with visitors on the site. The concept is simple.

  1. Users who have registered signup get their own account with rosters
  2. When a visitor comes to the home page of the social network, he can see some of the online members of the community
  3. Now he should be able to initiate a chat with them, by clicking on their name.

I have already got members to chat with their roster mates. My question is, how can I get an anonymous user to chat with a member and exchange presence info with him?

I have successfully managed to create anonymous accounts, members accounts and even send messages from an anonymous user to other members. But I cant get presence information from anonymous-user to member or vice versa?

BTW, the chat is JS based.

From stackoverflow
  • You're trying to break the XMPP model. Presence is an opt-in permission based system. You ask me if you can see my presence, I say yes. Generally my client will then automatically ask you if I can see your presence, and your client says yes. That's what the roster is -- yes's and no's to presence subscription requests.

    You can make chat rooms (MUC, multi user chat) that are anonymous, as well as do presence in them. It's not a roster, though. It's the closest to what you're describing without going into crazy-land with pubsub, and I don't know if you could even bend that tool far enough to have anonymous roster entries.

    Adil : Hi A.R . After a bit of research it seems to me MUC is the only sane way to go. Whats 'pusub', and where can i find more about it? Thnx for your reply.
    A. R. Diederich : Pubsub is short for "publish-subscribe". You use it to do things like offer data to people (geo location, music playing) and they subscribe to it. The XEP (XMPP Enhancement Proposal) is at In some areas a pubsub server is a PASS server -- publish and subscribe server, but that's getting off topic. Hmm, I may have been thinking of privacy lists, not pubsub. The XEP for pricay lists is found at You can use privacy lists to be "invisible" to some users, for example.
    Adil : Hi A.R. I looked into pubsub and its a bit more than i have time for (10th Jan!) . I think i'll be going with MUC and private rooms for my requirement. Do you have any suggestions that will help me do this faster. Any gotchas i should look out for? Thx, and i'll tick your answer.
    A. R. Diederich : No, nothing else to look for. Pubsub is a big XEP and I don't know if it'd work for you. I don't know if MUC will, either, but it's the closest thing there is to what you asked for.


Post a Comment