{"action":"created","comment":{"url":"https://api.github.com/repos/rails/rails/pulls/comments/221391449","pull_request_review_id":160036141,"id":221391449,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyMTM5MTQ0OQ==","diff_hunk":"@@ -36,6 +36,27 @@ def rack_response\n \n       private\n         attr_reader :websocket\n+\n+      @driver_selector = nil\n+      def self.create_driver(env, event_target, event_loop, protocols)\n+        case @driver_selector\n+        when :rack\n+          puts \"Remembered...\"\n+          return WebSocketRack.attempt(env, event_target, event_loop, protocols)\n+        when :driver\n+          return ::WebSocket::Driver.websocket?(env) && ClientSocket.new(env, event_target, event_loop, protocols)\n+        end\n+        return nil unless ::WebSocket::Driver.websocket?(env)\n+        puts \"Calculating memory...\"\n+        ret = WebSocketRack.attempt(env, event_target, event_loop, protocols)\n+        if (ret)\n+          @driver_selector = :rack","path":"actioncable/lib/action_cable/connection/web_socket.rb","position":null,"original_position":27,"commit_id":"20a77f5ad817b41403196bb545af32c163d2a0ed","original_commit_id":"9de5acf0711eb499d968947a35c841541b181349","user":{"login":"palkan","id":1516722,"node_id":"MDQ6VXNlcjE1MTY3MjI=","avatar_url":"https://avatars2.githubusercontent.com/u/1516722?v=4","gravatar_id":"","url":"https://api.github.com/users/palkan","html_url":"https://github.com/palkan","followers_url":"https://api.github.com/users/palkan/followers","following_url":"https://api.github.com/users/palkan/following{/other_user}","gists_url":"https://api.github.com/users/palkan/gists{/gist_id}","starred_url":"https://api.github.com/users/palkan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/palkan/subscriptions","organizations_url":"https://api.github.com/users/palkan/orgs","repos_url":"https://api.github.com/users/palkan/repos","events_url":"https://api.github.com/users/palkan/events{/privacy}","received_events_url":"https://api.github.com/users/palkan/received_events","type":"User","site_admin":false},"body":"Couldn't we just store a class here (`WebSocketRack` or `ClientSocket`) and convert `create_driver` into:\r\n\r\n```ruby\r\ndef driver_class(env)\r\n  @driver_class ||= begin\r\n\r\n  end\r\nend\r\n```\r\n\r\nAnd then use it in `initialize`: `@websocket = driver_class(env)&.new(env, event_target, ...)`.\r\n\r\nAnd also replace `attempt(env, ...)` with `available?(env)`.\r\n\r\n@boazsegev WDYT?","created_at":"2018-09-28T22:00:34Z","updated_at":"2018-09-28T22:00:41Z","html_url":"https://github.com/rails/rails/pull/33295#discussion_r221391449","pull_request_url":"https://api.github.com/repos/rails/rails/pulls/33295","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/rails/rails/pulls/comments/221391449"},"html":{"href":"https://github.com/rails/rails/pull/33295#discussion_r221391449"},"pull_request":{"href":"https://api.github.com/repos/rails/rails/pulls/33295"}}},"pull_request":{"url":"https://api.github.com/repos/rails/rails/pulls/33295","id":199413050,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk5NDEzMDUw","html_url":"https://github.com/rails/rails/pull/33295","diff_url":"https://github.com/rails/rails/pull/33295.diff","patch_url":"https://github.com/rails/rails/pull/33295.patch","issue_url":"https://api.github.com/repos/rails/rails/issues/33295","number":33295,"state":"open","locked":false,"title":"ActiveCable support for rack/rack PR #1272","user":{"login":"boazsegev","id":870622,"node_id":"MDQ6VXNlcjg3MDYyMg==","avatar_url":"https://avatars3.githubusercontent.com/u/870622?v=4","gravatar_id":"","url":"https://api.github.com/users/boazsegev","html_url":"https://github.com/boazsegev","followers_url":"https://api.github.com/users/boazsegev/followers","following_url":"https://api.github.com/users/boazsegev/following{/other_user}","gists_url":"https://api.github.com/users/boazsegev/gists{/gist_id}","starred_url":"https://api.github.com/users/boazsegev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/boazsegev/subscriptions","organizations_url":"https://api.github.com/users/boazsegev/orgs","repos_url":"https://api.github.com/users/boazsegev/repos","events_url":"https://api.github.com/users/boazsegev/events{/privacy}","received_events_url":"https://api.github.com/users/boazsegev/received_events","type":"User","site_admin":false},"body":"This adds native WebSocket support to ActiveCable, based on the [Rack PR #1272](https://github.com/rack/rack/pull/1272).\r\n\r\nTested using iodine version 0.6.4.\r\n\r\nIMHO, this is the best **compatible** approach, that still accommodates `hijack` support. It might not have been the best approach if `hijack` support was to be deprecated.\r\n\r\nThis approach should improve server-client performance. However, channel broadcasting performance is likely to experience the same bottlenecks that aren't addressed by this change.\r\n\r\nPlease note:\r\n\r\nThis approach moves the responsibility for the WebSocket and network logic to the Server, freeing the application and framework from protocol and network concerns.\r\n\r\nIMHO, it would make sense if the road-map were updated so `hijack` support would be dropped after the default server (currently Puma) implements the new Rack specification.\r\n\r\nThis would allow Rails to reduce it's dependencies and remove the `websocket-driver` and the `nio4r` gems from the dependency list.\r\n\r\nThis would also improve the separation of concerns, since the framework could be freed from IO or protocol related concerns.\r\n","created_at":"2018-07-05T09:39:33Z","updated_at":"2018-09-28T22:00:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9f0ed15ebe3e0b15d5d151bb13a1404c5627c420","assignee":{"login":"kaspth","id":350807,"node_id":"MDQ6VXNlcjM1MDgwNw==","avatar_url":"https://avatars0.githubusercontent.com/u/350807?v=4","gravatar_id":"","url":"https://api.github.com/users/kaspth","html_url":"https://github.com/kaspth","followers_url":"https://api.github.com/users/kaspth/followers","following_url":"https://api.github.com/users/kaspth/following{/other_user}","gists_url":"https://api.github.com/users/kaspth/gists{/gist_id}","starred_url":"https://api.github.com/users/kaspth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaspth/subscriptions","organizations_url":"https://api.github.com/users/kaspth/orgs","repos_url":"https://api.github.com/users/kaspth/repos","events_url":"https://api.github.com/users/kaspth/events{/privacy}","received_events_url":"https://api.github.com/users/kaspth/received_events","type":"User","site_admin":false},"assignees":[{"login":"kaspth","id":350807,"node_id":"MDQ6VXNlcjM1MDgwNw==","avatar_url":"https://avatars0.githubusercontent.com/u/350807?v=4","gravatar_id":"","url":"https://api.github.com/users/kaspth","html_url":"https://github.com/kaspth","followers_url":"https://api.github.com/users/kaspth/followers","following_url":"https://api.github.com/users/kaspth/following{/other_user}","gists_url":"https://api.github.com/users/kaspth/gists{/gist_id}","starred_url":"https://api.github.com/users/kaspth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaspth/subscriptions","organizations_url":"https://api.github.com/users/kaspth/orgs","repos_url":"https://api.github.com/users/kaspth/repos","events_url":"https://api.github.com/users/kaspth/events{/privacy}","received_events_url":"https://api.github.com/users/kaspth/received_events","type":"User","site_admin":false}],"requested_reviewers":[{"login":"matthewd","id":1034,"node_id":"MDQ6VXNlcjEwMzQ=","avatar_url":"https://avatars1.githubusercontent.com/u/1034?v=4","gravatar_id":"","url":"https://api.github.com/users/matthewd","html_url":"https://github.com/matthewd","followers_url":"https://api.github.com/users/matthewd/followers","following_url":"https://api.github.com/users/matthewd/following{/other_user}","gists_url":"https://api.github.com/users/matthewd/gists{/gist_id}","starred_url":"https://api.github.com/users/matthewd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matthewd/subscriptions","organizations_url":"https://api.github.com/users/matthewd/orgs","repos_url":"https://api.github.com/users/matthewd/repos","events_url":"https://api.github.com/users/matthewd/events{/privacy}","received_events_url":"https://api.github.com/users/matthewd/received_events","type":"User","site_admin":false},{"login":"tenderlove","id":3124,"node_id":"MDQ6VXNlcjMxMjQ=","avatar_url":"https://avatars1.githubusercontent.com/u/3124?v=4","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}],"requested_teams":[],"labels":[{"id":300028327,"node_id":"MDU6TGFiZWwzMDAwMjgzMjc=","url":"https://api.github.com/repos/rails/rails/labels/actioncable","name":"actioncable","color":"bfdadc","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/rails/rails/pulls/33295/commits","review_comments_url":"https://api.github.com/repos/rails/rails/pulls/33295/comments","review_comment_url":"https://api.github.com/repos/rails/rails/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rails/rails/issues/33295/comments","statuses_url":"https://api.github.com/repos/rails/rails/statuses/20a77f5ad817b41403196bb545af32c163d2a0ed","head":{"label":"boazsegev:master","ref":"master","sha":"20a77f5ad817b41403196bb545af32c163d2a0ed","user":{"login":"boazsegev","id":870622,"node_id":"MDQ6VXNlcjg3MDYyMg==","avatar_url":"https://avatars3.githubusercontent.com/u/870622?v=4","gravatar_id":"","url":"https://api.github.com/users/boazsegev","html_url":"https://github.com/boazsegev","followers_url":"https://api.github.com/users/boazsegev/followers","following_url":"https://api.github.com/users/boazsegev/following{/other_user}","gists_url":"https://api.github.com/users/boazsegev/gists{/gist_id}","starred_url":"https://api.github.com/users/boazsegev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/boazsegev/subscriptions","organizations_url":"https://api.github.com/users/boazsegev/orgs","repos_url":"https://api.github.com/users/boazsegev/repos","events_url":"https://api.github.com/users/boazsegev/events{/privacy}","received_events_url":"https://api.github.com/users/boazsegev/received_events","type":"User","site_admin":false},"repo":{"id":139820617,"node_id":"MDEwOlJlcG9zaXRvcnkxMzk4MjA2MTc=","name":"rails","full_name":"boazsegev/rails","private":false,"owner":{"login":"boazsegev","id":870622,"node_id":"MDQ6VXNlcjg3MDYyMg==","avatar_url":"https://avatars3.githubusercontent.com/u/870622?v=4","gravatar_id":"","url":"https://api.github.com/users/boazsegev","html_url":"https://github.com/boazsegev","followers_url":"https://api.github.com/users/boazsegev/followers","following_url":"https://api.github.com/users/boazsegev/following{/other_user}","gists_url":"https://api.github.com/users/boazsegev/gists{/gist_id}","starred_url":"https://api.github.com/users/boazsegev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/boazsegev/subscriptions","organizations_url":"https://api.github.com/users/boazsegev/orgs","repos_url":"https://api.github.com/users/boazsegev/repos","events_url":"https://api.github.com/users/boazsegev/events{/privacy}","received_events_url":"https://api.github.com/users/boazsegev/received_events","type":"User","site_admin":false},"html_url":"https://github.com/boazsegev/rails","description":"Ruby on Rails","fork":true,"url":"https://api.github.com/repos/boazsegev/rails","forks_url":"https://api.github.com/repos/boazsegev/rails/forks","keys_url":"https://api.github.com/repos/boazsegev/rails/keys{/key_id}","collaborators_url":"https://api.github.com/repos/boazsegev/rails/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/boazsegev/rails/teams","hooks_url":"https://api.github.com/repos/boazsegev/rails/hooks","issue_events_url":"https://api.github.com/repos/boazsegev/rails/issues/events{/number}","events_url":"https://api.github.com/repos/boazsegev/rails/events","assignees_url":"https://api.github.com/repos/boazsegev/rails/assignees{/user}","branches_url":"https://api.github.com/repos/boazsegev/rails/branches{/branch}","tags_url":"https://api.github.com/repos/boazsegev/rails/tags","blobs_url":"https://api.github.com/repos/boazsegev/rails/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/boazsegev/rails/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/boazsegev/rails/git/refs{/sha}","trees_url":"https://api.github.com/repos/boazsegev/rails/git/trees{/sha}","statuses_url":"https://api.github.com/repos/boazsegev/rails/statuses/{sha}","languages_url":"https://api.github.com/repos/boazsegev/rails/languages","stargazers_url":"https://api.github.com/repos/boazsegev/rails/stargazers","contributors_url":"https://api.github.com/repos/boazsegev/rails/contributors","subscribers_url":"https://api.github.com/repos/boazsegev/rails/subscribers","subscription_url":"https://api.github.com/repos/boazsegev/rails/subscription","commits_url":"https://api.github.com/repos/boazsegev/rails/commits{/sha}","git_commits_url":"https://api.github.com/repos/boazsegev/rails/git/commits{/sha}","comments_url":"https://api.github.com/repos/boazsegev/rails/comments{/number}","issue_comment_url":"https://api.github.com/repos/boazsegev/rails/issues/comments{/number}","contents_url":"https://api.github.com/repos/boazsegev/rails/contents/{+path}","compare_url":"https://api.github.com/repos/boazsegev/rails/compare/{base}...{head}","merges_url":"https://api.github.com/repos/boazsegev/rails/merges","archive_url":"https://api.github.com/repos/boazsegev/rails/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/boazsegev/rails/downloads","issues_url":"https://api.github.com/repos/boazsegev/rails/issues{/number}","pulls_url":"https://api.github.com/repos/boazsegev/rails/pulls{/number}","milestones_url":"https://api.github.com/repos/boazsegev/rails/milestones{/number}","notifications_url":"https://api.github.com/repos/boazsegev/rails/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/boazsegev/rails/labels{/name}","releases_url":"https://api.github.com/repos/boazsegev/rails/releases{/id}","deployments_url":"https://api.github.com/repos/boazsegev/rails/deployments","created_at":"2018-07-05T08:40:54Z","updated_at":"2018-09-28T21:59:57Z","pushed_at":"2018-09-28T21:59:54Z","git_url":"git://github.com/boazsegev/rails.git","ssh_url":"git@github.com:boazsegev/rails.git","clone_url":"https://github.com/boazsegev/rails.git","svn_url":"https://github.com/boazsegev/rails","homepage":"http://rubyonrails.org","size":164590,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"rails:master","ref":"master","sha":"ba38e13c8272f1d10cf2381d6e5d3021020c6f62","user":{"login":"rails","id":4223,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQyMjM=","avatar_url":"https://avatars1.githubusercontent.com/u/4223?v=4","gravatar_id":"","url":"https://api.github.com/users/rails","html_url":"https://github.com/rails","followers_url":"https://api.github.com/users/rails/followers","following_url":"https://api.github.com/users/rails/following{/other_user}","gists_url":"https://api.github.com/users/rails/gists{/gist_id}","starred_url":"https://api.github.com/users/rails/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rails/subscriptions","organizations_url":"https://api.github.com/users/rails/orgs","repos_url":"https://api.github.com/users/rails/repos","events_url":"https://api.github.com/users/rails/events{/privacy}","received_events_url":"https://api.github.com/users/rails/received_events","type":"Organization","site_admin":false},"repo":{"id":8514,"node_id":"MDEwOlJlcG9zaXRvcnk4NTE0","name":"rails","full_name":"rails/rails","private":false,"owner":{"login":"rails","id":4223,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQyMjM=","avatar_url":"https://avatars1.githubusercontent.com/u/4223?v=4","gravatar_id":"","url":"https://api.github.com/users/rails","html_url":"https://github.com/rails","followers_url":"https://api.github.com/users/rails/followers","following_url":"https://api.github.com/users/rails/following{/other_user}","gists_url":"https://api.github.com/users/rails/gists{/gist_id}","starred_url":"https://api.github.com/users/rails/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rails/subscriptions","organizations_url":"https://api.github.com/users/rails/orgs","repos_url":"https://api.github.com/users/rails/repos","events_url":"https://api.github.com/users/rails/events{/privacy}","received_events_url":"https://api.github.com/users/rails/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/rails/rails","description":"Ruby on Rails","fork":false,"url":"https://api.github.com/repos/rails/rails","forks_url":"https://api.github.com/repos/rails/rails/forks","keys_url":"https://api.github.com/repos/rails/rails/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rails/rails/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rails/rails/teams","hooks_url":"https://api.github.com/repos/rails/rails/hooks","issue_events_url":"https://api.github.com/repos/rails/rails/issues/events{/number}","events_url":"https://api.github.com/repos/rails/rails/events","assignees_url":"https://api.github.com/repos/rails/rails/assignees{/user}","branches_url":"https://api.github.com/repos/rails/rails/branches{/branch}","tags_url":"https://api.github.com/repos/rails/rails/tags","blobs_url":"https://api.github.com/repos/rails/rails/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rails/rails/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rails/rails/git/refs{/sha}","trees_url":"https://api.github.com/repos/rails/rails/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rails/rails/statuses/{sha}","languages_url":"https://api.github.com/repos/rails/rails/languages","stargazers_url":"https://api.github.com/repos/rails/rails/stargazers","contributors_url":"https://api.github.com/repos/rails/rails/contributors","subscribers_url":"https://api.github.com/repos/rails/rails/subscribers","subscription_url":"https://api.github.com/repos/rails/rails/subscription","commits_url":"https://api.github.com/repos/rails/rails/commits{/sha}","git_commits_url":"https://api.github.com/repos/rails/rails/git/commits{/sha}","comments_url":"https://api.github.com/repos/rails/rails/comments{/number}","issue_comment_url":"https://api.github.com/repos/rails/rails/issues/comments{/number}","contents_url":"https://api.github.com/repos/rails/rails/contents/{+path}","compare_url":"https://api.github.com/repos/rails/rails/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rails/rails/merges","archive_url":"https://api.github.com/repos/rails/rails/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rails/rails/downloads","issues_url":"https://api.github.com/repos/rails/rails/issues{/number}","pulls_url":"https://api.github.com/repos/rails/rails/pulls{/number}","milestones_url":"https://api.github.com/repos/rails/rails/milestones{/number}","notifications_url":"https://api.github.com/repos/rails/rails/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rails/rails/labels{/name}","releases_url":"https://api.github.com/repos/rails/rails/releases{/id}","deployments_url":"https://api.github.com/repos/rails/rails/deployments","created_at":"2008-04-11T02:19:47Z","updated_at":"2018-09-28T19:44:58Z","pushed_at":"2018-09-28T21:59:58Z","git_url":"git://github.com/rails/rails.git","ssh_url":"git@github.com:rails/rails.git","clone_url":"https://github.com/rails/rails.git","svn_url":"https://github.com/rails/rails","homepage":"https://rubyonrails.org","size":167078,"stargazers_count":40971,"watchers_count":40971,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":16558,"mirror_url":null,"archived":false,"open_issues_count":1059,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":16558,"open_issues":1059,"watchers":40971,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rails/rails/pulls/33295"},"html":{"href":"https://github.com/rails/rails/pull/33295"},"issue":{"href":"https://api.github.com/repos/rails/rails/issues/33295"},"comments":{"href":"https://api.github.com/repos/rails/rails/issues/33295/comments"},"review_comments":{"href":"https://api.github.com/repos/rails/rails/pulls/33295/comments"},"review_comment":{"href":"https://api.github.com/repos/rails/rails/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rails/rails/pulls/33295/commits"},"statuses":{"href":"https://api.github.com/repos/rails/rails/statuses/20a77f5ad817b41403196bb545af32c163d2a0ed"}},"author_association":"NONE"}}
{"actor":{"display_login":"palkan"}}