{"action":"opened","number":1840,"pull_request":{"url":"https://api.github.com/repos/phoenixframework/phoenix/pulls/1840","id":79307697,"html_url":"https://github.com/phoenixframework/phoenix/pull/1840","diff_url":"https://github.com/phoenixframework/phoenix/pull/1840.diff","patch_url":"https://github.com/phoenixframework/phoenix/pull/1840.patch","issue_url":"https://api.github.com/repos/phoenixframework/phoenix/issues/1840","number":1840,"state":"open","locked":false,"title":"Extract serialization into a separate class","user":{"login":"jmerriweather","id":2928714,"avatar_url":"https://avatars.githubusercontent.com/u/2928714?v=3","gravatar_id":"","url":"https://api.github.com/users/jmerriweather","html_url":"https://github.com/jmerriweather","followers_url":"https://api.github.com/users/jmerriweather/followers","following_url":"https://api.github.com/users/jmerriweather/following{/other_user}","gists_url":"https://api.github.com/users/jmerriweather/gists{/gist_id}","starred_url":"https://api.github.com/users/jmerriweather/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmerriweather/subscriptions","organizations_url":"https://api.github.com/users/jmerriweather/orgs","repos_url":"https://api.github.com/users/jmerriweather/repos","events_url":"https://api.github.com/users/jmerriweather/events{/privacy}","received_events_url":"https://api.github.com/users/jmerriweather/received_events","type":"User","site_admin":false},"body":"Extract serialization out so anyone can swap the serialization method. I'm currently using this for MessagePack serialization. It will fallback to JSON if LongPoll is detected.\r\n\r\nThis would allow someone to write a different serializer such as:\r\n```javascript\r\nimport msgpack from \"msgpack-js-v5\"\r\n\r\nexport default class MsgPackSerializer {\r\n\r\n  contentType() { return \"application/msgpack\" }\r\n\r\n  isBinary() { return true }\r\n\r\n  binaryType() { return \"arraybuffer\" }  \r\n\r\n  encode(payload, callback) {\r\n    callback(msgpack.encode(payload))\r\n  }\r\n\r\n  decode(payload, callback) {\r\n    var fileReader = new FileReader()\r\n    fileReader.onload = function(e) {\r\n      let bytes = new Uint8Array(e.target.result.slice(0, e.target.result.byteLength))\r\n      //console.log(\"about to decode message, that starts with\", bytes);\r\n      let msg = msgpack.decode(bytes)        \r\n      callback(msg)\r\n    }\r\n    fileReader.readAsArrayBuffer(payload)\r\n  }\r\n}\r\n```","created_at":"2016-07-29T05:12:52Z","updated_at":"2016-07-29T05:12:52Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/phoenixframework/phoenix/pulls/1840/commits","review_comments_url":"https://api.github.com/repos/phoenixframework/phoenix/pulls/1840/comments","review_comment_url":"https://api.github.com/repos/phoenixframework/phoenix/pulls/comments{/number}","comments_url":"https://api.github.com/repos/phoenixframework/phoenix/issues/1840/comments","statuses_url":"https://api.github.com/repos/phoenixframework/phoenix/statuses/87be53605fb67322f5c467e5f04afb04a691684c","head":{"label":"jmerriweather:support_js_serializers","ref":"support_js_serializers","sha":"87be53605fb67322f5c467e5f04afb04a691684c","user":{"login":"jmerriweather","id":2928714,"avatar_url":"https://avatars.githubusercontent.com/u/2928714?v=3","gravatar_id":"","url":"https://api.github.com/users/jmerriweather","html_url":"https://github.com/jmerriweather","followers_url":"https://api.github.com/users/jmerriweather/followers","following_url":"https://api.github.com/users/jmerriweather/following{/other_user}","gists_url":"https://api.github.com/users/jmerriweather/gists{/gist_id}","starred_url":"https://api.github.com/users/jmerriweather/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmerriweather/subscriptions","organizations_url":"https://api.github.com/users/jmerriweather/orgs","repos_url":"https://api.github.com/users/jmerriweather/repos","events_url":"https://api.github.com/users/jmerriweather/events{/privacy}","received_events_url":"https://api.github.com/users/jmerriweather/received_events","type":"User","site_admin":false},"repo":{"id":64450826,"name":"phoenix","full_name":"jmerriweather/phoenix","owner":{"login":"jmerriweather","id":2928714,"avatar_url":"https://avatars.githubusercontent.com/u/2928714?v=3","gravatar_id":"","url":"https://api.github.com/users/jmerriweather","html_url":"https://github.com/jmerriweather","followers_url":"https://api.github.com/users/jmerriweather/followers","following_url":"https://api.github.com/users/jmerriweather/following{/other_user}","gists_url":"https://api.github.com/users/jmerriweather/gists{/gist_id}","starred_url":"https://api.github.com/users/jmerriweather/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmerriweather/subscriptions","organizations_url":"https://api.github.com/users/jmerriweather/orgs","repos_url":"https://api.github.com/users/jmerriweather/repos","events_url":"https://api.github.com/users/jmerriweather/events{/privacy}","received_events_url":"https://api.github.com/users/jmerriweather/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jmerriweather/phoenix","description":"Productive. Reliable. Fast.","fork":true,"url":"https://api.github.com/repos/jmerriweather/phoenix","forks_url":"https://api.github.com/repos/jmerriweather/phoenix/forks","keys_url":"https://api.github.com/repos/jmerriweather/phoenix/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jmerriweather/phoenix/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jmerriweather/phoenix/teams","hooks_url":"https://api.github.com/repos/jmerriweather/phoenix/hooks","issue_events_url":"https://api.github.com/repos/jmerriweather/phoenix/issues/events{/number}","events_url":"https://api.github.com/repos/jmerriweather/phoenix/events","assignees_url":"https://api.github.com/repos/jmerriweather/phoenix/assignees{/user}","branches_url":"https://api.github.com/repos/jmerriweather/phoenix/branches{/branch}","tags_url":"https://api.github.com/repos/jmerriweather/phoenix/tags","blobs_url":"https://api.github.com/repos/jmerriweather/phoenix/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jmerriweather/phoenix/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jmerriweather/phoenix/git/refs{/sha}","trees_url":"https://api.github.com/repos/jmerriweather/phoenix/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jmerriweather/phoenix/statuses/{sha}","languages_url":"https://api.github.com/repos/jmerriweather/phoenix/languages","stargazers_url":"https://api.github.com/repos/jmerriweather/phoenix/stargazers","contributors_url":"https://api.github.com/repos/jmerriweather/phoenix/contributors","subscribers_url":"https://api.github.com/repos/jmerriweather/phoenix/subscribers","subscription_url":"https://api.github.com/repos/jmerriweather/phoenix/subscription","commits_url":"https://api.github.com/repos/jmerriweather/phoenix/commits{/sha}","git_commits_url":"https://api.github.com/repos/jmerriweather/phoenix/git/commits{/sha}","comments_url":"https://api.github.com/repos/jmerriweather/phoenix/comments{/number}","issue_comment_url":"https://api.github.com/repos/jmerriweather/phoenix/issues/comments{/number}","contents_url":"https://api.github.com/repos/jmerriweather/phoenix/contents/{+path}","compare_url":"https://api.github.com/repos/jmerriweather/phoenix/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jmerriweather/phoenix/merges","archive_url":"https://api.github.com/repos/jmerriweather/phoenix/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jmerriweather/phoenix/downloads","issues_url":"https://api.github.com/repos/jmerriweather/phoenix/issues{/number}","pulls_url":"https://api.github.com/repos/jmerriweather/phoenix/pulls{/number}","milestones_url":"https://api.github.com/repos/jmerriweather/phoenix/milestones{/number}","notifications_url":"https://api.github.com/repos/jmerriweather/phoenix/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jmerriweather/phoenix/labels{/name}","releases_url":"https://api.github.com/repos/jmerriweather/phoenix/releases{/id}","deployments_url":"https://api.github.com/repos/jmerriweather/phoenix/deployments","created_at":"2016-07-29T04:37:47Z","updated_at":"2016-07-29T04:37:49Z","pushed_at":"2016-07-29T05:04:40Z","git_url":"git://github.com/jmerriweather/phoenix.git","ssh_url":"git@github.com:jmerriweather/phoenix.git","clone_url":"https://github.com/jmerriweather/phoenix.git","svn_url":"https://github.com/jmerriweather/phoenix","homepage":"http://www.phoenixframework.org","size":5837,"stargazers_count":0,"watchers_count":0,"language":"Elixir","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"phoenixframework:master","ref":"master","sha":"a08eade7bbdbb46a839df949446345771c529580","user":{"login":"phoenixframework","id":6510388,"avatar_url":"https://avatars.githubusercontent.com/u/6510388?v=3","gravatar_id":"","url":"https://api.github.com/users/phoenixframework","html_url":"https://github.com/phoenixframework","followers_url":"https://api.github.com/users/phoenixframework/followers","following_url":"https://api.github.com/users/phoenixframework/following{/other_user}","gists_url":"https://api.github.com/users/phoenixframework/gists{/gist_id}","starred_url":"https://api.github.com/users/phoenixframework/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phoenixframework/subscriptions","organizations_url":"https://api.github.com/users/phoenixframework/orgs","repos_url":"https://api.github.com/users/phoenixframework/repos","events_url":"https://api.github.com/users/phoenixframework/events{/privacy}","received_events_url":"https://api.github.com/users/phoenixframework/received_events","type":"Organization","site_admin":false},"repo":{"id":16072585,"name":"phoenix","full_name":"phoenixframework/phoenix","owner":{"login":"phoenixframework","id":6510388,"avatar_url":"https://avatars.githubusercontent.com/u/6510388?v=3","gravatar_id":"","url":"https://api.github.com/users/phoenixframework","html_url":"https://github.com/phoenixframework","followers_url":"https://api.github.com/users/phoenixframework/followers","following_url":"https://api.github.com/users/phoenixframework/following{/other_user}","gists_url":"https://api.github.com/users/phoenixframework/gists{/gist_id}","starred_url":"https://api.github.com/users/phoenixframework/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phoenixframework/subscriptions","organizations_url":"https://api.github.com/users/phoenixframework/orgs","repos_url":"https://api.github.com/users/phoenixframework/repos","events_url":"https://api.github.com/users/phoenixframework/events{/privacy}","received_events_url":"https://api.github.com/users/phoenixframework/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/phoenixframework/phoenix","description":"Productive. Reliable. Fast.","fork":false,"url":"https://api.github.com/repos/phoenixframework/phoenix","forks_url":"https://api.github.com/repos/phoenixframework/phoenix/forks","keys_url":"https://api.github.com/repos/phoenixframework/phoenix/keys{/key_id}","collaborators_url":"https://api.github.com/repos/phoenixframework/phoenix/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/phoenixframework/phoenix/teams","hooks_url":"https://api.github.com/repos/phoenixframework/phoenix/hooks","issue_events_url":"https://api.github.com/repos/phoenixframework/phoenix/issues/events{/number}","events_url":"https://api.github.com/repos/phoenixframework/phoenix/events","assignees_url":"https://api.github.com/repos/phoenixframework/phoenix/assignees{/user}","branches_url":"https://api.github.com/repos/phoenixframework/phoenix/branches{/branch}","tags_url":"https://api.github.com/repos/phoenixframework/phoenix/tags","blobs_url":"https://api.github.com/repos/phoenixframework/phoenix/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/phoenixframework/phoenix/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/phoenixframework/phoenix/git/refs{/sha}","trees_url":"https://api.github.com/repos/phoenixframework/phoenix/git/trees{/sha}","statuses_url":"https://api.github.com/repos/phoenixframework/phoenix/statuses/{sha}","languages_url":"https://api.github.com/repos/phoenixframework/phoenix/languages","stargazers_url":"https://api.github.com/repos/phoenixframework/phoenix/stargazers","contributors_url":"https://api.github.com/repos/phoenixframework/phoenix/contributors","subscribers_url":"https://api.github.com/repos/phoenixframework/phoenix/subscribers","subscription_url":"https://api.github.com/repos/phoenixframework/phoenix/subscription","commits_url":"https://api.github.com/repos/phoenixframework/phoenix/commits{/sha}","git_commits_url":"https://api.github.com/repos/phoenixframework/phoenix/git/commits{/sha}","comments_url":"https://api.github.com/repos/phoenixframework/phoenix/comments{/number}","issue_comment_url":"https://api.github.com/repos/phoenixframework/phoenix/issues/comments{/number}","contents_url":"https://api.github.com/repos/phoenixframework/phoenix/contents/{+path}","compare_url":"https://api.github.com/repos/phoenixframework/phoenix/compare/{base}...{head}","merges_url":"https://api.github.com/repos/phoenixframework/phoenix/merges","archive_url":"https://api.github.com/repos/phoenixframework/phoenix/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/phoenixframework/phoenix/downloads","issues_url":"https://api.github.com/repos/phoenixframework/phoenix/issues{/number}","pulls_url":"https://api.github.com/repos/phoenixframework/phoenix/pulls{/number}","milestones_url":"https://api.github.com/repos/phoenixframework/phoenix/milestones{/number}","notifications_url":"https://api.github.com/repos/phoenixframework/phoenix/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/phoenixframework/phoenix/labels{/name}","releases_url":"https://api.github.com/repos/phoenixframework/phoenix/releases{/id}","deployments_url":"https://api.github.com/repos/phoenixframework/phoenix/deployments","created_at":"2014-01-20T14:14:11Z","updated_at":"2016-07-29T04:39:24Z","pushed_at":"2016-07-27T05:02:49Z","git_url":"git://github.com/phoenixframework/phoenix.git","ssh_url":"git@github.com:phoenixframework/phoenix.git","clone_url":"https://github.com/phoenixframework/phoenix.git","svn_url":"https://github.com/phoenixframework/phoenix","homepage":"http://www.phoenixframework.org","size":5837,"stargazers_count":7096,"watchers_count":7096,"language":"Elixir","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":794,"mirror_url":null,"open_issues_count":13,"forks":794,"open_issues":13,"watchers":7096,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/phoenixframework/phoenix/pulls/1840"},"html":{"href":"https://github.com/phoenixframework/phoenix/pull/1840"},"issue":{"href":"https://api.github.com/repos/phoenixframework/phoenix/issues/1840"},"comments":{"href":"https://api.github.com/repos/phoenixframework/phoenix/issues/1840/comments"},"review_comments":{"href":"https://api.github.com/repos/phoenixframework/phoenix/pulls/1840/comments"},"review_comment":{"href":"https://api.github.com/repos/phoenixframework/phoenix/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/phoenixframework/phoenix/pulls/1840/commits"},"statuses":{"href":"https://api.github.com/repos/phoenixframework/phoenix/statuses/87be53605fb67322f5c467e5f04afb04a691684c"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":2,"additions":62,"deletions":27,"changed_files":1}}
{"actor":{"display_login":"jmerriweather"}}