koa-socket.io icon indicating copy to clipboard operation
koa-socket.io copied to clipboard

Unable to connect

Open wyqydsyq opened this issue 6 years ago • 0 comments

So I'm trying to use this in a new, minimal Koa app. Following the Readme I have this code:

// websocket server
const io = new IO({
  namespace: '/'
})
io.start(http.createServer(app.callback()), {}, config.port, config.host)

// handle incoming ws client connections
io.on('connect', handleClientConnection)
io.on('ready', handleClientConnection)
io.on('join', handleClientConnection)

app.listen(config.port)

handleClientConnection is just firing a console.log for testing, which never fires, so it seems the Socket.IO server never starts or never accepts client connections.

My client throws when attempting to connect: Connection closed before receiving a handshake response

It seems this module is either broken entirely or has outdated docs, how is this supposed to work?

wyqydsyq avatar Mar 29 '18 06:03 wyqydsyq