Replies: 5 comments 8 replies
-
Facing the same problem with socket.io, what was your solution? |
Beta Was this translation helpful? Give feedback.
-
Here is a proposal for enabling access to the server instance in Next.js:
This proposal would allow developers to access the server instance in a way that is consistent with the new route handlers. It would also make it easier for developers to use Socket.io with Next.js. Here are some pros and cons of this proposal: Pros:
Cons:
Overall, I believe that the pros of this proposal outweigh the cons. I believe that this proposal would make it easier for developers to use Next.js and Socket.io. |
Beta Was this translation helpful? Give feedback.
-
I am trying to initialize socket.io, but getting
} if there is any way please mention |
Beta Was this translation helpful? Give feedback.
-
No idea, but this video uses the pages router instead alongside the app router: https://youtu.be/ZbX4Ok9YX94?t=29330 |
Beta Was this translation helpful? Give feedback.
-
Please check the example provided by SocketIO here: https://socket.io/how-to/use-with-nextjs It seems we have to create a custom server for our Next.js project that combining the Next.js app handler and other node.js server (like using something like |
Beta Was this translation helpful? Give feedback.
-
Goals
Non-Goals
No response
Background
It seems like pretty common practice for those using socket.io with next.js to do create a dummy route for initializing socket.io by accessing the server instance on the response object.
Given the new route handlers, theres currently no way to access the server instance.
Proposal
Enable some way of access the server instance
Beta Was this translation helpful? Give feedback.
All reactions