Confirmed users
93
edits
| Line 209: | Line 209: | ||
==== POST /v1/update ==== | ==== POST /v1/update ==== | ||
====== Registration Sync Protocol ====== | |||
Refresh the server from the client. | |||
</ | |||
This request requires a X-UserAgent-ID header. If the UserAgent attempts to POST information to the server which already has data for that X-UserAgent-ID, the server will deny the request with a 403 error. In that case, the UserAgent should request re-registration for all Channels. | |||
The UserAgent '''SHOULD''' | |||
a) Send a list of <channelID, version> pairs capturing its current state to PushServer, along with the UAID. | |||
b) If the PushServer accepts the request, it SHOULD update its records. UserAgent and PushServer are now back in sync. DONE | |||
c) If the PushServer detects a duplicate UAID, it SHOULD respond with an error. | |||
d) In this case, the client should invalidate its current state and ask apps application to re-register using | |||
the <tt>push-register</tt> system message. UserAgent and PushServer will now organically sync similar to standard /register calls. | |||
===== Arguments ===== | ===== Arguments ===== | ||
The POST body is a JSON encoded block: | |||
</ | <pre> | ||
{ | |||
"channels": [{"channelID1": "version1"}, {"channelID2": "version2"}, ...] | |||
} | |||
</pre> | |||
===== Returns ===== | ===== Returns ===== | ||
{ | |||
"digest": "..." | |||
} | |||
UserAgent should confirm match | |||
===== Errors ===== | |||
* ReRegister - The server may response with this for any reason, although usually it'll be due to duplicate UAID. | |||
===== Example ===== | ===== Example ===== | ||
<pre class="_fck_mw_lspace">POST http://push.m.o/v1/update | <pre class="_fck_mw_lspace">POST http://push.m.o/v1/update | ||
| Line 224: | Line 246: | ||
</pre> | </pre> | ||
<pre class="_fck_mw_lspace">--- | <pre class="_fck_mw_lspace">--- | ||
{} | {"digest": "..."} | ||
</pre> | </pre> | ||