2

I'm developing an android chat client, I decided to use XMPP and I started studying from the official XMPP RFC. The 7th chapter is about Resource Binding.

Now, for me it's clear the way that Resource Binding is technically realized but I really can't understand for what it could be useful.

To be more clear and straightforward:

  • what usefulness can it have on the chat client?
  • why should a chat client use this feature?
  • what usefulness can it have on the chat server?
  • why should a chat server use this feature?

I read the guidelines of stackoverflow. I'm not asking for an opinion. I would like to have an explanation of how and why this feature could/should be implemented in an application.

Flow
  • 22,048
  • 13
  • 91
  • 147
Roger 71
  • 121
  • 7
  • so that you can send a file to a specific resource – elmorabea Dec 18 '14 at 11:22
  • I've updated the linked RFC, you used the old one, which makes resource binding optional, wheres the new RFC 6120 makes resource binding mandatory. – Flow Dec 18 '14 at 12:49

1 Answers1

5

Resources are used to distinguish different sessions of the same account, in particular on different devices. It would be very unhelpful if half of your file goes to a different device if that device signs on in the middle of a file transfer.

So to answer your questions:

  • So your client can distinguish between different sessions of the user's contacts and make sure the stanzas end up at the correct one.
  • Because servers (almost) always require it.
  • So the server can allow multiple sessions on the same account and can distinguish what session a stanza is for.
  • Because people want to be able to sign on to their account from multiple devices.

Any server will assign a random and unique resource for you if the client doesn't specify one. There isn't really a clear "best solution" here:

  • The resource may be a hint for your contacts about where or what that device is, such as "home", "office", "laptop", "phone".
  • However, specifying an easy to guess resource will make it possible for others to determine whether you are online or not (only the people you have allowed to do that should be able to determine that).
  • Two clients that are trying to use the same resource often lead to loops where they keep kicking the other off.
xnyhps
  • 3,136
  • 15
  • 19
  • Thank you very much, I think I understood your explanation. Just a clarification: I'm going to implement XMPP inside an android app; users will not be able to chat with clients different than the one inside the app; the app will force the creation of different accounts for different telephone numbers. Would it be correct to paste always the same resource name (e.g."myChatClientName") after each bare Jid (accounName@domain)? If the answer to precedent question is yes, would it be correct to use an empty string as the resource name? – Roger 71 Dec 18 '14 at 12:39
  • As I said in my post, using a static resource like "myChatClientName" could reveal to other people whether someone is currently signed in. Whether you consider that a problem is up to you. An empty string is not a valid resource. – xnyhps Dec 18 '14 at 13:12