Socket.io #1698
Unanswered
sistematico
asked this question in
Q&A
Socket.io
#1698
Replies: 1 comment 3 replies
-
I believe you can create something like this (haven't test yet): import { serve } from '@hono/node-server'
import { Hono } from 'hono'
import { WebSocketServer } from 'ws'
const app = new Hono()
const server = serve(app)
const ws = new WebSocketServer({ server })
ws.on('connection', (socket) => {
socket.on('error', console.error)
socket.on('message', (data) => console.log('message:', data))
socket.send('something')
}) |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Anyway to use Hono with Socket.io, WebSockets or Bun builtin WebSockets?
Thank you in advance.
Beta Was this translation helpful? Give feedback.
All reactions