Hi! I'm try to use koa-socket-2 in my project with middleware. I took an example from docs and it doesn't work for me.
Here is example of my code:
const Koa = require('koa');
const IO = require('koa-socket-2');
const appSock = new Koa();
const cpIo = new IO({
namespace: 'cp-clients',
});
cpIo.attach(appSock);
cpIo.use(async (ctx, next) => {
console.log('midleware 1');
await next();
console.log('midleware 2');
});
appSock.listen(3333, () => {
console.log('Sockets starts at localhost:3333');
})
All code work well but middleware don't fired when new message is received.
What is wrong with it?
Hi! I'm try to use koa-socket-2 in my project with middleware. I took an example from docs and it doesn't work for me.
Here is example of my code:
All code work well but middleware don't fired when new message is received.
What is wrong with it?