HonoH
Hono2y ago
Blankeos

Have you guys ever gotten websockets to work on Hono + `@hono/vite-dev-server` plugin?

This occurs for Bun and Node.
  1. On Bun, I can serve websockets using import { createBunWebSocket } from 'hono/bun'; https://github.com/honojs/vite-plugins/issues/148
  2. On Node, I can serve websockets using ws and import { serve } from '@hono/node-server'
__

But the issues are:

  1. On Bun, the websocket handler gets stuck. No idea why: https://github.com/honojs/vite-plugins/issues/140. Had some hypothesis that it conflicts with vite, but not too sure.
  1. On Node, I can't even run the websocket handler because the mechanism is completely different when running it in dev. In particular, you'd have to get the server first, then attach it there.
Was this page helpful?