{"action":"created","issue":{"url":"https://api.github.com/repos/rails/rails/issues/10040","repository_url":"https://api.github.com/repos/rails/rails","labels_url":"https://api.github.com/repos/rails/rails/issues/10040/labels{/name}","comments_url":"https://api.github.com/repos/rails/rails/issues/10040/comments","events_url":"https://api.github.com/repos/rails/rails/issues/10040/events","html_url":"https://github.com/rails/rails/pull/10040","id":12687240,"number":10040,"title":"Add SSE functionality for rails based on AC::Live","user":{"login":"dahakawang","id":2820550,"avatar_url":"https://avatars.githubusercontent.com/u/2820550?v=3","gravatar_id":"","url":"https://api.github.com/users/dahakawang","html_url":"https://github.com/dahakawang","followers_url":"https://api.github.com/users/dahakawang/followers","following_url":"https://api.github.com/users/dahakawang/following{/other_user}","gists_url":"https://api.github.com/users/dahakawang/gists{/gist_id}","starred_url":"https://api.github.com/users/dahakawang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dahakawang/subscriptions","organizations_url":"https://api.github.com/users/dahakawang/orgs","repos_url":"https://api.github.com/users/dahakawang/repos","events_url":"https://api.github.com/users/dahakawang/events{/privacy}","received_events_url":"https://api.github.com/users/dahakawang/received_events","type":"User","site_admin":false},"labels":[{"id":107189,"url":"https://api.github.com/repos/rails/rails/labels/actionpack","name":"actionpack","color":"FFF700","default":false}],"state":"open","locked":false,"assignee":{"login":"tenderlove","id":3124,"avatar_url":"https://avatars.githubusercontent.com/u/3124?v=3","gravatar_id":"","url":"https://api.github.com/users/tenderlove","html_url":"https://github.com/tenderlove","followers_url":"https://api.github.com/users/tenderlove/followers","following_url":"https://api.github.com/users/tenderlove/following{/other_user}","gists_url":"https://api.github.com/users/tenderlove/gists{/gist_id}","starred_url":"https://api.github.com/users/tenderlove/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tenderlove/subscriptions","organizations_url":"https://api.github.com/users/tenderlove/orgs","repos_url":"https://api.github.com/users/tenderlove/repos","events_url":"https://api.github.com/users/tenderlove/events{/privacy}","received_events_url":"https://api.github.com/users/tenderlove/received_events","type":"User","site_admin":true},"assignees":[{"login":"tenderlove","id":3124,"avatar_url":"https://avatars.githubusercontent.com/u/3124?v=3","gravatar_id":"","url":"https://api.github.com/users/tenderlove","html_url":"https://github.com/tenderlove","followers_url":"https://api.github.com/users/tenderlove/followers","following_url":"https://api.github.com/users/tenderlove/following{/other_user}","gists_url":"https://api.github.com/users/tenderlove/gists{/gist_id}","starred_url":"https://api.github.com/users/tenderlove/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tenderlove/subscriptions","organizations_url":"https://api.github.com/users/tenderlove/orgs","repos_url":"https://api.github.com/users/tenderlove/repos","events_url":"https://api.github.com/users/tenderlove/events{/privacy}","received_events_url":"https://api.github.com/users/tenderlove/received_events","type":"User","site_admin":true}],"milestone":null,"comments":6,"created_at":"2013-04-02T01:59:25Z","updated_at":"2016-12-09T00:03:30Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/rails/rails/pulls/10040","html_url":"https://github.com/rails/rails/pull/10040","diff_url":"https://github.com/rails/rails/pull/10040.diff","patch_url":"https://github.com/rails/rails/pull/10040.patch"},"body":"This class is an initial implementation of HTML5 SSE for rails. Currently we provide 2 kinds of ways to implement a SSE server. The first is controller level SSE, in which we do not distinguish clients and will send data to all the clients that subscribe the same sse source.\nThe second is client level SSE, which we DO distinguish clients and the data sent to different client can be totally different.\n## Controlller level SSE:\n\n``` ruby\nclass MySSE < ActionController::Base\n  include ActionController::Live\n  include ActionController::ServerSentEvents\n  extend ActionController::ServerSentEvents::ClassMethods\nend\n```\n\nin this way, an action named `sse_source` will be created automaticlly and you can use `MySSE.send_sse` or `MySSE.send_sse_hash` to send event to all clients that subscribed the sse_source (you should register the action in route.rb manually)\n## Client level SSE(Session awared):\n\n``` ruby\nclass MySSE < ActionController::Base\n  include ActionController::Live\n  include ActionController::ServerSentEvents\n\n  def event\n    start_serve do |sse_client|\n      # we can access some session variables here\n      sse_client.send_sse sse\n      sse_client.send_sse_hash :data => \"david\"\n    end\n\n  end\nend\n```\n\nPlease note that Controller level SSE and Client level SSE are not meant to\nwork together in the same controller.\n"},"comment":{"url":"https://api.github.com/repos/rails/rails/issues/comments/265893531","html_url":"https://github.com/rails/rails/pull/10040#issuecomment-265893531","issue_url":"https://api.github.com/repos/rails/rails/issues/10040","id":265893531,"user":{"login":"tenderlove","id":3124,"avatar_url":"https://avatars.githubusercontent.com/u/3124?v=3","gravatar_id":"","url":"https://api.github.com/users/tenderlove","html_url":"https://github.com/tenderlove","followers_url":"https://api.github.com/users/tenderlove/followers","following_url":"https://api.github.com/users/tenderlove/following{/other_user}","gists_url":"https://api.github.com/users/tenderlove/gists{/gist_id}","starred_url":"https://api.github.com/users/tenderlove/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tenderlove/subscriptions","organizations_url":"https://api.github.com/users/tenderlove/orgs","repos_url":"https://api.github.com/users/tenderlove/repos","events_url":"https://api.github.com/users/tenderlove/events{/privacy}","received_events_url":"https://api.github.com/users/tenderlove/received_events","type":"User","site_admin":true},"created_at":"2016-12-09T00:03:30Z","updated_at":"2016-12-09T00:03:30Z","body":"I like the feature.  Is there a way we can implement this as a gem first though?"}}
{"actor":{"display_login":"tenderlove"}}