Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Think of a way to implement server-to-client push notification #139

Open
michielbdejong opened this issue Dec 3, 2015 · 16 comments
Open

Comments

@michielbdejong
Copy link
Member

This came up on the mailing list. HTTP doesn't really allow this, but I think HTTP/2 does? We could also use WebSockets or HTML5 push notifications somehow.

@untitaker
Copy link
Member

This one is easiest: https://en.wikipedia.org/wiki/Server-sent_events

@untitaker
Copy link
Member

Concretely: https://html.spec.whatwg.org/multipage/comms.html#server-sent-events

No extra port needed, very simple data format, and JS supports it out of the box.

@ghost
Copy link

ghost commented Dec 3, 2015

Rationale / Use-case?

@untitaker
Copy link
Member

Right, the direct archive link would be useful.

Instant sync, also etherpad-like apps would be possible (though still hard).

@raucao
Copy link
Member

raucao commented Dec 3, 2015

How about just defining the format and leaving the transport to the app/client developer? That way we could have an API in rs.js for basically "got this from server, do sth with it".

Edit: that was just a quick thought. Already seeing issues with not defining the transport right now. ;)

@untitaker
Copy link
Member

To clarify, "server-to-client" notifications means something like "fs events" to me (since remoteStorage is an FS), not a general-purpose event system where every client can "register" events.

@raucao
Copy link
Member

raucao commented Dec 3, 2015

A push notification is not really a normal event. It usually means you're not listening actively, and only waiting for the push notification to arrive (e.g. in a ServiceWorker), before your app activates and does sth with it. No?

@untitaker
Copy link
Member

Iunno, I thought it'd be basically the same thing, with the difference that in your case you'd just "subscribe to all events"

@raucao
Copy link
Member

raucao commented Dec 3, 2015

Not really. For push notifications you usually just subscribe to the Important Stuff™. Not sure what that would even means in RS context, though.

Edit: so yes, SSE seems like it could bring more value, replacing those pesty sync requests somewhat.

@untitaker
Copy link
Member

In the context of RS I thought you could subscribe to any item (folder/file) and listen to etag changes.

In particular you'd send a request to its URL with a special header (similar to Connection: keep-alive), and the server would write to the response if the etag changes (as defined in HTTP SSE)

This would allow for "instant" re-sync of a tree without much additional complexity.

EDIT: Just realized that this sort of protocol is not RS specific, since it only depends on etags it could be its own spec.

@raucao
Copy link
Member

raucao commented Dec 3, 2015

This would allow for "instant" re-sync of a tree without much additional complexity.

... on the client side. It's considerable complexity on the server side of course, because you need to do things asynchronously and keep sessions open for all connected clients at all times.

@raucao
Copy link
Member

raucao commented Dec 3, 2015

In reality we'd probably have like one common node.js app that you can hook into, but which you have to deploy in addition to your normal RS server.

@untitaker
Copy link
Member

... on the client side. It's considerable complexity on the server side of course, especially because you need to do things asynchronously and keep sessions open for all connected clients at all times.

This is a problem with any possible "push notifications" implementation, unless you use a separate piece of software.

If you're going to have a single node.js app, we don't even need to properly spec the serverside.

@raucao
Copy link
Member

raucao commented Dec 3, 2015

If you're going to have a single node.js app, we don't even need to properly spec the serverside.

The API towards the server for subscribing has to be defined, of course. Also, discovery of such an endpoint.

@untitaker
Copy link
Member

Either way this might be a candidate for its own RFC. Could we have a label for those?

@raucao
Copy link
Member

raucao commented Feb 3, 2018

Either way this might be a candidate for its own RFC. Could we have a label for those?

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants