Closed vjpr closed 8 years ago
This commit allows passing options through to the socket.io instance that is being created when attaching to the app, e.g.
const socket = new IO({
ioOptions: {
destroyUpgrade: false
}
})
This should work fine even when attaching only namespaces, I'm writing some tests now.
Alternatively, creating the socket.io instance inside koa-socket is only a convenience, it can be created manually and attached to the app yourself:
const app = new Koa()
const server = http.createServer( app.callback() )
const io = new socketIO( server, {
destroyUpgrade: false
})
app._io = io
const chat = new IO( 'chat' )
chat.attach( app )
io.listen()
Note that manually creating the socket.io server yourself means that you must use namespaces, default namespace will not work.
I think the whole server creation stuff needs a little work, it could be much cleaner.
I need to pass an option to socket.io (engine.io) like so
app.io = socketIO(app.server, {destroyUpgrade: false})
. This is currently not possible. The oldio.set
api is deprecated too.