DEVELOPER.rst 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. Subscription flow
  2. =================
  3. Happy flow
  4. ----------
  5. Contact1 makes a presence subscription request to contact2.
  6. ::
  7. <presence type="subscribe" to="contact2@localhost"/>
  8. Contact1 receives a roster update
  9. ::
  10. <iq type="set" to="contact1@localhost">
  11. <query xmlns="jabber:iq:roster">
  12. <item jid="contact2@localhost" ask="subscribe" subscription="none"></item>
  13. </query>
  14. </iq>
  15. Contact2 receives the presence subscription, but no
  16. roster update. We create a roster item manually in
  17. handleIncomingSubscription and add the 'requesting'
  18. property to indicate that this is an incoming request.
  19. Contact2 clicks "Accept". This confirms the
  20. subscription and subscribes back.
  21. ::
  22. <presence type="subscribed" to="contact1@localhost"/>
  23. <presence type="subscribe" to="contact1@localhost"/>
  24. IF Contact1 is still online and likewise subscribes back, Contact2 will receive a roster update
  25. ::
  26. <iq type="set" to="contact2@localhost">
  27. <query xmlns="jabber:iq:roster">
  28. <item jid="contact1@localhost" ask="subscribe" subscription="from"></item>
  29. </query>
  30. </iq>
  31. ELSE, Contact 2 will receive a roster update (but not an IQ stanza)
  32. ::
  33. ask = null
  34. subscription = "from"
  35. Contact1's converse.js client will automatically
  36. approve.
  37. Contact2 receives a roster update (as does contact1).
  38. ::
  39. <iq type="set" to="contact2@localhost">
  40. <query xmlns="jabber:iq:roster">
  41. <item jid="contact1@localhost" subscription="both"></item>
  42. </query>
  43. </iq>