Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Middleware doesn't work. #18

Open
kurakste opened this issue Sep 16, 2019 · 1 comment
Open

Middleware doesn't work. #18

kurakste opened this issue Sep 16, 2019 · 1 comment

Comments

@kurakste
Copy link

kurakste commented Sep 16, 2019

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?

@vladbash
Copy link

vladbash commented Feb 12, 2020

You should try to look at #14. I think this is a duplicate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants