Skip to content

Middleware doesn't work. #18

@kurakste

Description

@kurakste

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions