On 10/05/2016 09:29, Edouard Oger wrote:
> Hello everyone,
>
> We want to use the new Push API to improve the general latency of Sync
> between operations.
> Let's consider for example the case of sending a tab to another synced
> device : Device A writes in the /clients collection an opentab command
> and pushes its changes to the sync server. On its next sync, Device B
> will pick up the new tabs in the /clients collection and open them.
> We want to keep this behavior because it works and we would like to
> avoid having push servers as a mandatory dependency.
> The plan is to send a Push notification to Device B to tell it to sync
> its /clients collection immediately because "something changed".
> In this case, the push technology only accelerates things, but does not
> change the underlying protocol.
>
> Which brings us to the architecture problem:
> The Firefox Accounts servers already have a list of devices and their
> associated pushCallbackUrls, but this server is not hit when we sync
> things up and it would be semantically bizarre to send a request to this
> server after syncing something.
Something else to consider, is whether FxA should allow direct use of
that push endpoints by other services, or whether it should mediate the
message sending. Personally I mean towards having FxA mediate the send.
This would mean, rather than having the sender of the message pull down
the device list, iterate through the push endpoints, construct encrypted
payloads, and send the notifications, we would have it simply call an
endpoint on the FxA server, and FxA would handle the mechanics of
distributing the message.
> We discussed this with ckarlof and we ended up thinking that the sync
> storage servers should send the notifications themselves: Post-sync,
> retrieve the device list from the FxA server, maybe cache it, try to
> figure out the correspondence between its own device list and the FxA
> device list (is this a solved problem?)
I don't think the sync server in its present form can do this, as it
doesn't have its own notion of a "device list". It contains encrypted
client records, but it cant read them because encryption.
There's an attractive simplicity to Richard's suggestion that the client
itself do this. A first version might be as simple as making an
authenticated POST request like this strawman:
POST /v1/account/devices/notify HTTP/1.1
Host: api.accounts.firefox.com
Authentication: your session-token signature here
{
version: 1
action: "syncNow"
}
And letting FxA route the message to all connected devices.
(As Richard points out, you may not *want* all the clients to sync all
their data in a push-driven way, because it might trigger all sorts of
edge-cases and data loss. If you restricted to syncing the clients
collection it would probably be fine.)
Cheers,
Ryan
_______________________________________________
Sync-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/sync-dev