payload: {"action":"created","comment":{"url":"https://api.github.com/repos/google/chicago-brick/pulls/comments/303894444","pull_request_review_id":262397502,"id":303894444,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDMwMzg5NDQ0NA==","diff_hunk":"@@ -52,28 +52,16 @@ export function send(event, data) {\n     socket.emit(event, data);\n   }\n }\n+\n+// Return an object that can be opened to create an isolated per-module network,\n+// and closed to clean up after that module.\n export function forModule(id) {","path":"client/network/network.js","position":49,"original_position":49,"commit_id":"a27d281247787b9ea057733743716d4727c66dc2","original_commit_id":"a27d281247787b9ea057733743716d4727c66dc2","user":{"login":"applmak","id":2245625,"node_id":"MDQ6VXNlcjIyNDU2MjU=","avatar_url":"https://avatars2.githubusercontent.com/u/2245625?v=4","gravatar_id":"","url":"https://api.github.com/users/applmak","html_url":"https://github.com/applmak","followers_url":"https://api.github.com/users/applmak/followers","following_url":"https://api.github.com/users/applmak/following{/other_user}","gists_url":"https://api.github.com/users/applmak/gists{/gist_id}","starred_url":"https://api.github.com/users/applmak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/applmak/subscriptions","organizations_url":"https://api.github.com/users/applmak/orgs","repos_url":"https://api.github.com/users/applmak/repos","events_url":"https://api.github.com/users/applmak/events{/privacy}","received_events_url":"https://api.github.com/users/applmak/received_events","type":"User","site_admin":false},"body":"*this* part is not the scary one, because in this case, in the lcient binary, there's only ever 1 socket to worry about, so everything is easy: framework communication happens on the socket, module communication happens on this wrapped module overlay socket. The scary one is the equivalent in server/network/network.js.","created_at":"2019-07-16T13:01:44Z","updated_at":"2019-07-16T13:01:44Z","html_url":"https://github.com/google/chicago-brick/pull/273#discussion_r303894444","pull_request_url":"https://api.github.com/repos/google/chicago-brick/pulls/273","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/google/chicago-brick/pulls/comments/303894444"},"html":{"href":"https://github.com/google/chicago-brick/pull/273#discussion_r303894444"},"pull_request":{"href":"https://api.github.com/repos/google/chicago-brick/pulls/273"}},"in_reply_to_id":303706741},"pull_request":{"url":"https://api.github.com/repos/google/chicago-brick/pulls/273","id":293004352,"node_id":"MDExOlB1bGxSZXF1ZXN0MjkzMDA0MzUy","html_url":"https://github.com/google/chicago-brick/pull/273","diff_url":"https://github.com/google/chicago-brick/pull/273.diff","patch_url":"https://github.com/google/chicago-brick/pull/273.patch","issue_url":"https://api.github.com/repos/google/chicago-brick/issues/273","number":273,"state":"open","locked":false,"title":"Multiplex per-module network on a single connection","user":{"login":"applmak","id":2245625,"node_id":"MDQ6VXNlcjIyNDU2MjU=","avatar_url":"https://avatars2.githubusercontent.com/u/2245625?v=4","gravatar_id":"","url":"https://api.github.com/users/applmak","html_url":"https://github.com/applmak","followers_url":"https://api.github.com/users/applmak/followers","following_url":"https://api.github.com/users/applmak/following{/other_user}","gists_url":"https://api.github.com/users/applmak/gists{/gist_id}","starred_url":"https://api.github.com/users/applmak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/applmak/subscriptions","organizations_url":"https://api.github.com/users/applmak/orgs","repos_url":"https://api.github.com/users/applmak/repos","events_url":"https://api.github.com/users/applmak/events{/privacy}","received_events_url":"https://api.github.com/users/applmak/received_events","type":"User","site_admin":false},"body":"This completely changes the way that per-module networking works.\r\nBefore, we relied on socket.io namespaces to ensure that no module could\r\naccidentally communicate with another module that was running at the\r\nsame time. This worked, but had three major drawbacks:\r\n\r\n1. Relied on internal, undocumented socket.io APIs to ensure proper\r\n   cleanup of namespace sockets.\r\n2. Messages sent before receiver was ready were dropped, which required\r\n   modules to invent complicated mechanisms to ensure both server &\r\n   client were ready before communicating.\r\n3. Initial handshake on namespace caused a noticeable CPU spike on the\r\n   client which dropped some frames.\r\n\r\nThis change addresses each of those concerns:\r\n1. One socket is opened per server and client, avoiding the need for\r\n   cleanup.\r\n2. Messages are always queued up and processed when the other party\r\n   inits and begins registering handlers.\r\n3. No additional connections are formed, removing the CPU spike.\r\n\r\nThis changes the API for modules, though, as there is no more\r\n'connection' or 'reconnect' messages (as we maintain a persistent)\r\nconnection. Module authors are advised to instead have clients send a\r\nmessage to the server when ready to receive any critical missives, and\r\nthe new infrastructure will ensure proper behavior.","created_at":"2019-06-29T01:22:54Z","updated_at":"2019-07-16T13:01:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":"aecd7ec1e7194eb6a6ba7c9823ac037d9a902e07","assignee":{"login":"jmegq","id":699634,"node_id":"MDQ6VXNlcjY5OTYzNA==","avatar_url":"https://avatars0.githubusercontent.com/u/699634?v=4","gravatar_id":"","url":"https://api.github.com/users/jmegq","html_url":"https://github.com/jmegq","followers_url":"https://api.github.com/users/jmegq/followers","following_url":"https://api.github.com/users/jmegq/following{/other_user}","gists_url":"https://api.github.com/users/jmegq/gists{/gist_id}","starred_url":"https://api.github.com/users/jmegq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmegq/subscriptions","organizations_url":"https://api.github.com/users/jmegq/orgs","repos_url":"https://api.github.com/users/jmegq/repos","events_url":"https://api.github.com/users/jmegq/events{/privacy}","received_events_url":"https://api.github.com/users/jmegq/received_events","type":"User","site_admin":false},"assignees":[{"login":"jmegq","id":699634,"node_id":"MDQ6VXNlcjY5OTYzNA==","avatar_url":"https://avatars0.githubusercontent.com/u/699634?v=4","gravatar_id":"","url":"https://api.github.com/users/jmegq","html_url":"https://github.com/jmegq","followers_url":"https://api.github.com/users/jmegq/followers","following_url":"https://api.github.com/users/jmegq/following{/other_user}","gists_url":"https://api.github.com/users/jmegq/gists{/gist_id}","starred_url":"https://api.github.com/users/jmegq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmegq/subscriptions","organizations_url":"https://api.github.com/users/jmegq/orgs","repos_url":"https://api.github.com/users/jmegq/repos","events_url":"https://api.github.com/users/jmegq/events{/privacy}","received_events_url":"https://api.github.com/users/jmegq/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/google/chicago-brick/pulls/273/commits","review_comments_url":"https://api.github.com/repos/google/chicago-brick/pulls/273/comments","review_comment_url":"https://api.github.com/repos/google/chicago-brick/pulls/comments{/number}","comments_url":"https://api.github.com/repos/google/chicago-brick/issues/273/comments","statuses_url":"https://api.github.com/repos/google/chicago-brick/statuses/a27d281247787b9ea057733743716d4727c66dc2","head":{"label":"google:multiplexed-networking","ref":"multiplexed-networking","sha":"a27d281247787b9ea057733743716d4727c66dc2","user":{"login":"google","id":1342004,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEzNDIwMDQ=","avatar_url":"https://avatars1.githubusercontent.com/u/1342004?v=4","gravatar_id":"","url":"https://api.github.com/users/google","html_url":"https://github.com/google","followers_url":"https://api.github.com/users/google/followers","following_url":"https://api.github.com/users/google/following{/other_user}","gists_url":"https://api.github.com/users/google/gists{/gist_id}","starred_url":"https://api.github.com/users/google/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/google/subscriptions","organizations_url":"https://api.github.com/users/google/orgs","repos_url":"https://api.github.com/users/google/repos","events_url":"https://api.github.com/users/google/events{/privacy}","received_events_url":"https://api.github.com/users/google/received_events","type":"Organization","site_admin":false},"repo":{"id":50162607,"node_id":"MDEwOlJlcG9zaXRvcnk1MDE2MjYwNw==","name":"chicago-brick","full_name":"google/chicago-brick","private":false,"owner":{"login":"google","id":1342004,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEzNDIwMDQ=","avatar_url":"https://avatars1.githubusercontent.com/u/1342004?v=4","gravatar_id":"","url":"https://api.github.com/users/google","html_url":"https://github.com/google","followers_url":"https://api.github.com/users/google/followers","following_url":"https://api.github.com/users/google/following{/other_user}","gists_url":"https://api.github.com/users/google/gists{/gist_id}","starred_url":"https://api.github.com/users/google/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/google/subscriptions","organizations_url":"https://api.github.com/users/google/orgs","repos_url":"https://api.github.com/users/google/repos","events_url":"https://api.github.com/users/google/events{/privacy}","received_events_url":"https://api.github.com/users/google/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/google/chicago-brick","description":"Software that displays content on a multi-node video wall.","fork":false,"url":"https://api.github.com/repos/google/chicago-brick","forks_url":"https://api.github.com/repos/google/chicago-brick/forks","keys_url":"https://api.github.com/repos/google/chicago-brick/keys{/key_id}","collaborators_url":"https://api.github.com/repos/google/chicago-brick/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/google/chicago-brick/teams","hooks_url":"https://api.github.com/repos/google/chicago-brick/hooks","issue_events_url":"https://api.github.com/repos/google/chicago-brick/issues/events{/number}","events_url":"https://api.github.com/repos/google/chicago-brick/events","assignees_url":"https://api.github.com/repos/google/chicago-brick/assignees{/user}","branches_url":"https://api.github.com/repos/google/chicago-brick/branches{/branch}","tags_url":"https://api.github.com/repos/google/chicago-brick/tags","blobs_url":"https://api.github.com/repos/google/chicago-brick/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/google/chicago-brick/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/google/chicago-brick/git/refs{/sha}","trees_url":"https://api.github.com/repos/google/chicago-brick/git/trees{/sha}","statuses_url":"https://api.github.com/repos/google/chicago-brick/statuses/{sha}","languages_url":"https://api.github.com/repos/google/chicago-brick/languages","stargazers_url":"https://api.github.com/repos/google/chicago-brick/stargazers","contributors_url":"https://api.github.com/repos/google/chicago-brick/contributors","subscribers_url":"https://api.github.com/repos/google/chicago-brick/subscribers","subscription_url":"https://api.github.com/repos/google/chicago-brick/subscription","commits_url":"https://api.github.com/repos/google/chicago-brick/commits{/sha}","git_commits_url":"https://api.github.com/repos/google/chicago-brick/git/commits{/sha}","comments_url":"https://api.github.com/repos/google/chicago-brick/comments{/number}","issue_comment_url":"https://api.github.com/repos/google/chicago-brick/issues/comments{/number}","contents_url":"https://api.github.com/repos/google/chicago-brick/contents/{+path}","compare_url":"https://api.github.com/repos/google/chicago-brick/compare/{base}...{head}","merges_url":"https://api.github.com/repos/google/chicago-brick/merges","archive_url":"https://api.github.com/repos/google/chicago-brick/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/google/chicago-brick/downloads","issues_url":"https://api.github.com/repos/google/chicago-brick/issues{/number}","pulls_url":"https://api.github.com/repos/google/chicago-brick/pulls{/number}","milestones_url":"https://api.github.com/repos/google/chicago-brick/milestones{/number}","notifications_url":"https://api.github.com/repos/google/chicago-brick/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/google/chicago-brick/labels{/name}","releases_url":"https://api.github.com/repos/google/chicago-brick/releases{/id}","deployments_url":"https://api.github.com/repos/google/chicago-brick/deployments","created_at":"2016-01-22T06:32:09Z","updated_at":"2019-07-16T02:39:25Z","pushed_at":"2019-07-16T02:39:26Z","git_url":"git://github.com/google/chicago-brick.git","ssh_url":"git@github.com:google/chicago-brick.git","clone_url":"https://github.com/google/chicago-brick.git","svn_url":"https://github.com/google/chicago-brick","homepage":"","size":13316,"stargazers_count":108,"watchers_count":108,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":false,"has_wiki":true,"has_pages":true,"forks_count":26,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":34,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":26,"open_issues":34,"watchers":108,"default_branch":"master"}},"base":{"label":"google:master","ref":"master","sha":"f6731c283f0f9c128d15ce3d320b7c4e348c7bef","user":{"login":"google","id":1342004,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEzNDIwMDQ=","avatar_url":"https://avatars1.githubusercontent.com/u/1342004?v=4","gravatar_id":"","url":"https://api.github.com/users/google","html_url":"https://github.com/google","followers_url":"https://api.github.com/users/google/followers","following_url":"https://api.github.com/users/google/following{/other_user}","gists_url":"https://api.github.com/users/google/gists{/gist_id}","starred_url":"https://api.github.com/users/google/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/google/subscriptions","organizations_url":"https://api.github.com/users/google/orgs","repos_url":"https://api.github.com/users/google/repos","events_url":"https://api.github.com/users/google/events{/privacy}","received_events_url":"https://api.github.com/users/google/received_events","type":"Organization","site_admin":false},"repo":{"id":50162607,"node_id":"MDEwOlJlcG9zaXRvcnk1MDE2MjYwNw==","name":"chicago-brick","full_name":"google/chicago-brick","private":false,"owner":{"login":"google","id":1342004,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEzNDIwMDQ=","avatar_url":"https://avatars1.githubusercontent.com/u/1342004?v=4","gravatar_id":"","url":"https://api.github.com/users/google","html_url":"https://github.com/google","followers_url":"https://api.github.com/users/google/followers","following_url":"https://api.github.com/users/google/following{/other_user}","gists_url":"https://api.github.com/users/google/gists{/gist_id}","starred_url":"https://api.github.com/users/google/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/google/subscriptions","organizations_url":"https://api.github.com/users/google/orgs","repos_url":"https://api.github.com/users/google/repos","events_url":"https://api.github.com/users/google/events{/privacy}","received_events_url":"https://api.github.com/users/google/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/google/chicago-brick","description":"Software that displays content on a multi-node video wall.","fork":false,"url":"https://api.github.com/repos/google/chicago-brick","forks_url":"https://api.github.com/repos/google/chicago-brick/forks","keys_url":"https://api.github.com/repos/google/chicago-brick/keys{/key_id}","collaborators_url":"https://api.github.com/repos/google/chicago-brick/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/google/chicago-brick/teams","hooks_url":"https://api.github.com/repos/google/chicago-brick/hooks","issue_events_url":"https://api.github.com/repos/google/chicago-brick/issues/events{/number}","events_url":"https://api.github.com/repos/google/chicago-brick/events","assignees_url":"https://api.github.com/repos/google/chicago-brick/assignees{/user}","branches_url":"https://api.github.com/repos/google/chicago-brick/branches{/branch}","tags_url":"https://api.github.com/repos/google/chicago-brick/tags","blobs_url":"https://api.github.com/repos/google/chicago-brick/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/google/chicago-brick/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/google/chicago-brick/git/refs{/sha}","trees_url":"https://api.github.com/repos/google/chicago-brick/git/trees{/sha}","statuses_url":"https://api.github.com/repos/google/chicago-brick/statuses/{sha}","languages_url":"https://api.github.com/repos/google/chicago-brick/languages","stargazers_url":"https://api.github.com/repos/google/chicago-brick/stargazers","contributors_url":"https://api.github.com/repos/google/chicago-brick/contributors","subscribers_url":"https://api.github.com/repos/google/chicago-brick/subscribers","subscription_url":"https://api.github.com/repos/google/chicago-brick/subscription","commits_url":"https://api.github.com/repos/google/chicago-brick/commits{/sha}","git_commits_url":"https://api.github.com/repos/google/chicago-brick/git/commits{/sha}","comments_url":"https://api.github.com/repos/google/chicago-brick/comments{/number}","issue_comment_url":"https://api.github.com/repos/google/chicago-brick/issues/comments{/number}","contents_url":"https://api.github.com/repos/google/chicago-brick/contents/{+path}","compare_url":"https://api.github.com/repos/google/chicago-brick/compare/{base}...{head}","merges_url":"https://api.github.com/repos/google/chicago-brick/merges","archive_url":"https://api.github.com/repos/google/chicago-brick/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/google/chicago-brick/downloads","issues_url":"https://api.github.com/repos/google/chicago-brick/issues{/number}","pulls_url":"https://api.github.com/repos/google/chicago-brick/pulls{/number}","milestones_url":"https://api.github.com/repos/google/chicago-brick/milestones{/number}","notifications_url":"https://api.github.com/repos/google/chicago-brick/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/google/chicago-brick/labels{/name}","releases_url":"https://api.github.com/repos/google/chicago-brick/releases{/id}","deployments_url":"https://api.github.com/repos/google/chicago-brick/deployments","created_at":"2016-01-22T06:32:09Z","updated_at":"2019-07-16T02:39:25Z","pushed_at":"2019-07-16T02:39:26Z","git_url":"git://github.com/google/chicago-brick.git","ssh_url":"git@github.com:google/chicago-brick.git","clone_url":"https://github.com/google/chicago-brick.git","svn_url":"https://github.com/google/chicago-brick","homepage":"","size":13316,"stargazers_count":108,"watchers_count":108,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":false,"has_wiki":true,"has_pages":true,"forks_count":26,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":34,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":26,"open_issues":34,"watchers":108,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/google/chicago-brick/pulls/273"},"html":{"href":"https://github.com/google/chicago-brick/pull/273"},"issue":{"href":"https://api.github.com/repos/google/chicago-brick/issues/273"},"comments":{"href":"https://api.github.com/repos/google/chicago-brick/issues/273/comments"},"review_comments":{"href":"https://api.github.com/repos/google/chicago-brick/pulls/273/comments"},"review_comment":{"href":"https://api.github.com/repos/google/chicago-brick/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/google/chicago-brick/pulls/273/commits"},"statuses":{"href":"https://api.github.com/repos/google/chicago-brick/statuses/a27d281247787b9ea057733743716d4727c66dc2"}},"author_association":"COLLABORATOR"}}
other: {"actor":{"display_login":"applmak"}}