How to handle Websocket using "hono/vercel" running on NodeJS environment.
I am using NextJS 14 App Router with Hono to handle the API routes. I followed the documentation using 'hono/vercel', but it seems that it doesn't support WebSocket. Then, I switched to 'hono/node-server/vercel', but I encountered some problems with the response (I cannot use it). Please help me. 😩
3 Replies
Seems like Vercel doesn't have WebSockets support, you will have to use one of the provided providers to add WebSockets in your app - https://vercel.com/guides/do-vercel-serverless-functions-support-websocket-connections
Do Vercel Serverless Functions support WebSocket connections?
Information on Vercel's support for WebSocket connections with Serverless Functions.
But what If I don't deploy on Vercel but deploy to a Serverfull on Nodejs Environment?
And what about a problem with "hono/node-server/vercel", I followed the docs but encounter that error
If you are deploying it on the server with nodejs then it's just node server so it will work, Here is an issue for this discussion - https://github.com/honojs/hono/issues/1153
GitHub
WebSockets · Issue #1153 · honojs/hono
Please implement WebSockets feature in honojs. https://developers.cloudflare.com/workers/runtime-apis/websockets/