{"action":"created","issue":{"url":"https://api.github.com/repos/bitpay/bitcore-p2p/issues/66","labels_url":"https://api.github.com/repos/bitpay/bitcore-p2p/issues/66/labels{/name}","comments_url":"https://api.github.com/repos/bitpay/bitcore-p2p/issues/66/comments","events_url":"https://api.github.com/repos/bitpay/bitcore-p2p/issues/66/events","html_url":"https://github.com/bitpay/bitcore-p2p/pull/66","id":70978673,"number":66,"title":"Fix Browserify support","user":{"login":"mappum","id":398285,"avatar_url":"https://avatars.githubusercontent.com/u/398285?v=3","gravatar_id":"","url":"https://api.github.com/users/mappum","html_url":"https://github.com/mappum","followers_url":"https://api.github.com/users/mappum/followers","following_url":"https://api.github.com/users/mappum/following{/other_user}","gists_url":"https://api.github.com/users/mappum/gists{/gist_id}","starred_url":"https://api.github.com/users/mappum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mappum/subscriptions","organizations_url":"https://api.github.com/users/mappum/orgs","repos_url":"https://api.github.com/users/mappum/repos","events_url":"https://api.github.com/users/mappum/events{/privacy}","received_events_url":"https://api.github.com/users/mappum/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2015-04-25T23:04:08Z","updated_at":"2015-05-12T03:22:08Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/bitpay/bitcore-p2p/pulls/66","html_url":"https://github.com/bitpay/bitcore-p2p/pull/66","diff_url":"https://github.com/bitpay/bitcore-p2p/pull/66.diff","patch_url":"https://github.com/bitpay/bitcore-p2p/pull/66.patch"},"body":"The procedural `require()`s in `lib/messages/builder.js` were causing problems for Browserify (message building would fail since the constructors were not detected as dependencies and would not be included in the bundle). This PR changes `builder.js` to use an explicit `require()` for each command.\r\n\r\nPreviously, the builder contained a map of the commands, the values being the names. I changed this so the values are now the `require`d constructors, which each now have a `_name` property.\r\n\r\nThe tests were also updated to work with this change."},"comment":{"url":"https://api.github.com/repos/bitpay/bitcore-p2p/issues/comments/101115306","html_url":"https://github.com/bitpay/bitcore-p2p/pull/66#issuecomment-101115306","issue_url":"https://api.github.com/repos/bitpay/bitcore-p2p/issues/66","id":101115306,"user":{"login":"mappum","id":398285,"avatar_url":"https://avatars.githubusercontent.com/u/398285?v=3","gravatar_id":"","url":"https://api.github.com/users/mappum","html_url":"https://github.com/mappum","followers_url":"https://api.github.com/users/mappum/followers","following_url":"https://api.github.com/users/mappum/following{/other_user}","gists_url":"https://api.github.com/users/mappum/gists{/gist_id}","starred_url":"https://api.github.com/users/mappum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mappum/subscriptions","organizations_url":"https://api.github.com/users/mappum/orgs","repos_url":"https://api.github.com/users/mappum/repos","events_url":"https://api.github.com/users/mappum/events{/privacy}","received_events_url":"https://api.github.com/users/mappum/received_events","type":"User","site_admin":false},"created_at":"2015-05-12T03:22:08Z","updated_at":"2015-05-12T03:22:08Z","body":"To clarify, I'm not opening an issue or suggesting to make changes to support browserify. This is a PR that includes all the necessary changes to make bitcore-p2p build in browserify. The connection code does not automatically port to browsers, but that is only a small part of this package (if you look at it, most of the volume of code is for bitcoin protocol serialization/deserialization, not managing connections).\r\n\r\n@braydonf Please consider pulling this PR, as it will make Bitcoin network protocol serialization possible in the browser. Thank you :+1:"}}