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

socket.io should listen to server, not app #14

Open
lchauvin opened this issue Oct 5, 2022 · 0 comments
Open

socket.io should listen to server, not app #14

lchauvin opened this issue Oct 5, 2022 · 0 comments

Comments

@lchauvin
Copy link

lchauvin commented Oct 5, 2022

I'm not sure how this works, but when I tried to reproduce this code, it didn't work.

I believe it's because socket.io is listening to Server(app), while it should listen to $server, which is what the server returns.

So I believe, the line 'var io = require('socket.io')(http)' should be moved after '$server = app.listen(3000, ...)', and should be modified to be 'var io = require('socket.io')(server)'

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

1 participant