{"action":"created","issue":{"url":"https://api.github.com/repos/DevvitIO/Multiplayer-Hangman/issues/32","repository_url":"https://api.github.com/repos/DevvitIO/Multiplayer-Hangman","labels_url":"https://api.github.com/repos/DevvitIO/Multiplayer-Hangman/issues/32/labels{/name}","comments_url":"https://api.github.com/repos/DevvitIO/Multiplayer-Hangman/issues/32/comments","events_url":"https://api.github.com/repos/DevvitIO/Multiplayer-Hangman/issues/32/events","html_url":"https://github.com/DevvitIO/Multiplayer-Hangman/pull/32","id":366050376,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE5ODIxOTAz","number":32,"title":"Implemented multiplayer functionality and game logic","user":{"login":"MichaelNey","id":25756024,"node_id":"MDQ6VXNlcjI1NzU2MDI0","avatar_url":"https://avatars3.githubusercontent.com/u/25756024?v=4","gravatar_id":"","url":"https://api.github.com/users/MichaelNey","html_url":"https://github.com/MichaelNey","followers_url":"https://api.github.com/users/MichaelNey/followers","following_url":"https://api.github.com/users/MichaelNey/following{/other_user}","gists_url":"https://api.github.com/users/MichaelNey/gists{/gist_id}","starred_url":"https://api.github.com/users/MichaelNey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MichaelNey/subscriptions","organizations_url":"https://api.github.com/users/MichaelNey/orgs","repos_url":"https://api.github.com/users/MichaelNey/repos","events_url":"https://api.github.com/users/MichaelNey/events{/privacy}","received_events_url":"https://api.github.com/users/MichaelNey/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-10-02T19:41:58Z","updated_at":"2018-10-03T12:02:38Z","closed_at":null,"author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/DevvitIO/Multiplayer-Hangman/pulls/32","html_url":"https://github.com/DevvitIO/Multiplayer-Hangman/pull/32","diff_url":"https://github.com/DevvitIO/Multiplayer-Hangman/pull/32.diff","patch_url":"https://github.com/DevvitIO/Multiplayer-Hangman/pull/32.patch"},"body":""},"comment":{"url":"https://api.github.com/repos/DevvitIO/Multiplayer-Hangman/issues/comments/426611152","html_url":"https://github.com/DevvitIO/Multiplayer-Hangman/pull/32#issuecomment-426611152","issue_url":"https://api.github.com/repos/DevvitIO/Multiplayer-Hangman/issues/32","id":426611152,"node_id":"MDEyOklzc3VlQ29tbWVudDQyNjYxMTE1Mg==","user":{"login":"KenavR","id":6655009,"node_id":"MDQ6VXNlcjY2NTUwMDk=","avatar_url":"https://avatars1.githubusercontent.com/u/6655009?v=4","gravatar_id":"","url":"https://api.github.com/users/KenavR","html_url":"https://github.com/KenavR","followers_url":"https://api.github.com/users/KenavR/followers","following_url":"https://api.github.com/users/KenavR/following{/other_user}","gists_url":"https://api.github.com/users/KenavR/gists{/gist_id}","starred_url":"https://api.github.com/users/KenavR/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KenavR/subscriptions","organizations_url":"https://api.github.com/users/KenavR/orgs","repos_url":"https://api.github.com/users/KenavR/repos","events_url":"https://api.github.com/users/KenavR/events{/privacy}","received_events_url":"https://api.github.com/users/KenavR/received_events","type":"User","site_admin":false},"created_at":"2018-10-03T12:02:38Z","updated_at":"2018-10-03T12:02:38Z","author_association":"MEMBER","body":"## Getting it running\r\n\r\nI am not sure, but I believe you copied the `socket.js` manually to the `dist` directory since the build system doesn't do that the socket connection didn't work (`io` was not available). \r\n\r\nThere are a couple of ways to fix that and I need your feedback to tell me if I should change the build system. Currently, everything that is imported/required web pack adds to the bundle.js. Other than in the past the build process does not add loaded libraries to the `window` object. Which means rather than just using the `io` object you need to import/require it, like in node. I made the following changes to get it running without changing the build process.\r\n\r\n### clientSocket.js\r\nAdded the following line to the top of the file\r\n\r\n```js\r\n    var io = require(\"socket.io-client\");\r\n```\r\n\r\n### index.html\r\nRemoved `<script src=\"socket.js\"></script>`\r\n\r\n### socket.js\r\nDeleted the file, because `socket.io-client` get imported from the node_modules.\r\n\r\nLet me know if you'd rather use it differently.\r\n\r\n-----------------------------------------------------------------\r\n\r\n## Regarding the new code\r\nI generally like the structure, it has a clear distinction between `Actions` and `Callbacks`. The only two improvements I would make are\r\n\r\n1. Cache dom nodes\r\n`document.getElementById('game-message')` is called every time a message comes in. Rather than querying the dom in every callback, you could query it once at the beginning, store it in a variable and use that. => less DOM interaction = better performance (not really important here but for the future)\r\n\r\n1. Make it DRY-er (Don't repeat yourself)\r\nThe socket callbacks all look very similar, you could create a single function and reuse it for every message."}}
{"actor":{"display_login":"KenavR"}}