{"action":"created","issue":{"url":"https://api.github.com/repos/socketio/socket.io/issues/2300","labels_url":"https://api.github.com/repos/socketio/socket.io/issues/2300/labels{/name}","comments_url":"https://api.github.com/repos/socketio/socket.io/issues/2300/comments","events_url":"https://api.github.com/repos/socketio/socket.io/issues/2300/events","html_url":"https://github.com/socketio/socket.io/issues/2300","id":115674787,"number":2300,"title":"How to connect to a server that also uses Webpack HMR middleware?","user":{"login":"0x80","id":1193520,"avatar_url":"https://avatars.githubusercontent.com/u/1193520?v=3","gravatar_id":"","url":"https://api.github.com/users/0x80","html_url":"https://github.com/0x80","followers_url":"https://api.github.com/users/0x80/followers","following_url":"https://api.github.com/users/0x80/following{/other_user}","gists_url":"https://api.github.com/users/0x80/gists{/gist_id}","starred_url":"https://api.github.com/users/0x80/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/0x80/subscriptions","organizations_url":"https://api.github.com/users/0x80/orgs","repos_url":"https://api.github.com/users/0x80/repos","events_url":"https://api.github.com/users/0x80/events{/privacy}","received_events_url":"https://api.github.com/users/0x80/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-11-07T16:11:22Z","updated_at":"2015-11-07T19:54:51Z","closed_at":null,"body":"I have a Koa server using webpack-dev-middleware and webpack-hot-middleware doing hot module replacement (HMR), so the middleware uses a websocket to push changes to the client.\r\n\r\nBut my application code also needs its own websocket connection between the client and the Koa server. I have no idea how to achieve that? Seems like the two are conflicting. Can I have them side by side?\r\n\r\nMy server code looks something like this\r\n```javascript\r\n    const compiler = webpack(webpackConfig)\r\n    const app = new Koa()\r\n    \r\n    app.use(webpackDevMiddleware(compiler, {\r\n      quiet: true,\r\n      noInfo: true\r\n      stats: {\r\n        colors: true,\r\n        reasons: true\r\n      }\r\n    })))\r\n    \r\n    app.use(webpackHotMiddleware(compiler))\r\n    \r\n    const server = require('http').createServer(app.callback())\r\n    const io = require('socket.io')(server)\r\n    io.on('connection', function() { console.log('socket connection!!') })\r\n```\r\nAnd my client something like\r\n``` javascript\r\n    import Client from 'socket.io-client'\r\n    const io = Client()\r\n    io.on('connect', (socket) => {\r\n      console.log('+++ io connected! ++++')\r\n      io.on('disconnect', () => { console.log('disconnected', socket) })\r\n    })\r\n```\r\nThe HMR socket is working correctly, but my other socket is trying to talk to \r\n`GET /socket.io/?EIO=3&transport=polling&t=1446911862461-0` and those requests are failing.\r\n\r\nHow do I create a websocket that doesn't clash with the HMR socket?"},"comment":{"url":"https://api.github.com/repos/socketio/socket.io/issues/comments/154743240","html_url":"https://github.com/socketio/socket.io/issues/2300#issuecomment-154743240","issue_url":"https://api.github.com/repos/socketio/socket.io/issues/2300","id":154743240,"user":{"login":"0x80","id":1193520,"avatar_url":"https://avatars.githubusercontent.com/u/1193520?v=3","gravatar_id":"","url":"https://api.github.com/users/0x80","html_url":"https://github.com/0x80","followers_url":"https://api.github.com/users/0x80/followers","following_url":"https://api.github.com/users/0x80/following{/other_user}","gists_url":"https://api.github.com/users/0x80/gists{/gist_id}","starred_url":"https://api.github.com/users/0x80/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/0x80/subscriptions","organizations_url":"https://api.github.com/users/0x80/orgs","repos_url":"https://api.github.com/users/0x80/repos","events_url":"https://api.github.com/users/0x80/events{/privacy}","received_events_url":"https://api.github.com/users/0x80/received_events","type":"User","site_admin":false},"created_at":"2015-11-07T19:54:51Z","updated_at":"2015-11-07T19:54:51Z","body":"I've found a solution. I'm using engine.io directly instead of socket.io. In my app the client and server don't have to go through http. :rocket: "}}