-
Notifications
You must be signed in to change notification settings - Fork 11
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
Support for streaming / SSE #15
Labels
Comments
Probably |
Try to keep the API compatible with what Aaron describes here: http://www.youtube.com/watch?v=kufXhNkm5WU . Maybe just change the included module to |
Related to #42 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Idea: Allow to easily deliver notifications to clients from Rails/Rack apps using SSE.
Algorithm:
Subscription
From Rails/Rack application respond with
Transfer-Encoding: chunked
header for the request.Verify user and store
sender_id
andconnection_uuid
of his request somewhere (current thread, db, redis, whatever).This leaves open connection in the browser that can be used later for delivering SSE.
Sending notification
When there is an event that you would like to inform user about (ex. friend added a picture) send chunked part to the same
sender_id
,connection_uuid
that we stored in db. Mongrel2 allows it and will forward to the browser.If chunked response uses SSE format then it can be used by JS SSE API in HTML5 browsers.
Main areas of concern regarding integration with Rails
access from Rails app to handler
How can one use
#deliver
method from our handler in the Rails/Rack application. In other words, how can such higher level reach something from low-level ?We could expose the handler itself in rack env.
That would allow to reach it from Rails action in controller using:
subscribing to disconnected event
I don't have yet an idea as how to subscribe from Rails app to
on_disconnected
event in the handler. I would like to avoid foricing users to inhreit from the RackHandler to plug in their application behavior.The text was updated successfully, but these errors were encountered: