Mercurial > prosody-modules
comparison mod_http_roster_admin/README.markdown @ 3006:e6f91e00b507
mod_http_roster_admin: Add missing protocol docs
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sun, 29 Apr 2018 08:33:54 +0100 |
parents | 234d679076c4 |
children | af1b3cef52e1 |
comparison
equal
deleted
inserted
replaced
3005:902ecd6400bd | 3006:e6f91e00b507 |
---|---|
42 | 42 |
43 When the user *john* then connects to Prosody, and `http_roster_url` is | 43 When the user *john* then connects to Prosody, and `http_roster_url` is |
44 set to “http://app.example.org/contacts/%s”, then Prosody will make a | 44 set to “http://app.example.org/contacts/%s”, then Prosody will make a |
45 GET request to http://app.example.org/contacts/john | 45 GET request to http://app.example.org/contacts/john |
46 | 46 |
47 ## Notifying Prosody of roster changes | 47 ## Protocol |
48 | |
49 ### Fetching rosters (Prosody to web app) | |
50 | |
51 Prosody considers the web application to always hold the most accurate and up-to-date | |
52 version of the user's roster. When a user first connects, Prosody fetches the roster | |
53 from the web application and caches it internally. | |
54 | |
55 Prosody will make a GET request to the URL specified in Prosody's configuration parameter | |
56 'http_roster_url'. In this URL, the pattern '%s' is replaced by an URL-encoded username. | |
57 | |
58 For example, when the user 'john' connects to Prosody, and http_roster_url is set | |
59 to "http://app.example.com/contacts/%s", Prosody will make a GET request to "http://app.example.com/contacts/john". | |
60 | |
61 The web app must return a JSON object, where each key is the JID of a contact, and the corresponding | |
62 value is data about that contact. | |
63 | |
64 If the user 'john' has friends 'marie' and 'michael', the web app would return a HTTP '200 OK' response | |
65 with the following contents: | |
66 | |
67 { | |
68 "marie@example.com": { | |
69 "name": "Marie" | |
70 }, | |
71 | |
72 "michael@example.com": { | |
73 "name": "Michael" | |
74 } | |
75 } | |
76 | |
77 ### Notifying Prosody of roster changes | |
48 | 78 |
49 The external service needs to notify Prosody whenever a user's roster | 79 The external service needs to notify Prosody whenever a user's roster |
50 changes. To do this, it must make an HTTP POST request to either: | 80 changes. To do this, it must make an HTTP POST request to either: |
51 | 81 |
52 - http://localhost:5280/roster_admin/refresh | 82 - http://localhost:5280/roster_admin/refresh |