Integrating Socket.IO with the App Router #50097
Replies: 3 comments 1 reply
-
I don't get why is this closed? Can't even find the related discussion/issue. |
Beta Was this translation helpful? Give feedback.
-
Please check out 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.
-
For anyone looking for a detailed guide on using WebSocket in Next.js with the app router and Socket.IO, I’ve written an article that might help: How to Use WebSocket in Next.js App Router with Socket.IO. The article covers:
I hope this can save you some time and effort. Feedback and suggestions are always welcome! |
Beta Was this translation helpful? Give feedback.
-
Hello! Has anyone been successful at integrating the Socket.IO server with the app router?
Using the pages folder, it is quite easy to bind the Websocket server to
res.socket.server.io
, but I don't see a way to do this now that Route Handlers don't provide theres
object.Can anyone help me to figure this out?
Beta Was this translation helpful? Give feedback.
All reactions