honojs-middleware/packages/node-ws
Shotaro Nakamura d11c3a565f
feat: Introduce WebSocket helper for Node.js | `@hono/node-ws` (#503)
* feat: Introduce WebSocket helper for Node.js | `@hono/node-ws`

* feat(node-ws): add ci and build command

* chore: update yarn.lock

* update `yarn.lock`

* fixed the ci config

* add `@hono/node-server` to devDependecies

* fixed format and specify node version

* fix(node-ws/docs): fix example

* feat: `upgradeWebSocket` be named function

---------

Co-authored-by: Yusuke Wada <yusuke@kamawada.com>
2024-05-09 21:51:25 +09:00
..
src feat: Introduce WebSocket helper for Node.js | `@hono/node-ws` (#503) 2024-05-09 21:51:25 +09:00
README.md feat: Introduce WebSocket helper for Node.js | `@hono/node-ws` (#503) 2024-05-09 21:51:25 +09:00
package.json feat: Introduce WebSocket helper for Node.js | `@hono/node-ws` (#503) 2024-05-09 21:51:25 +09:00
tsconfig.json feat: Introduce WebSocket helper for Node.js | `@hono/node-ws` (#503) 2024-05-09 21:51:25 +09:00
vitest.config.ts feat: Introduce WebSocket helper for Node.js | `@hono/node-ws` (#503) 2024-05-09 21:51:25 +09:00

README.md

WebSocket helper for Node.js

A WebSocket helper for Node.js

Usage

import { createNodeWebSocket } from '@hono/node-ws'
import { Hono } from 'hono'
import { serve } from '@hono/node-server'

const app = new Hono()

const { injectWebSocket, upgradeWebSocket } = createNodeWebSocket({ app })

app.get('/ws', upgradeWebSocket((c) => ({
  // https://hono.dev/helpers/websocket
})))

const server = serve(app)
injectWebSocket(server)

Author

Shotaro Nakamura https://github.com/nakasyou

License

MIT