bun-express-ws
v1.0.7
Published
Quickly implement websocket API in express
Downloads
2
Readme
bun-express-ws
Fork of wll8's improved express-ws that utilizes Bun's built-in WebSocket implementation. For more information about what's different between wll8's version and the unscoped package please see wll8's readme.
Usage
bun install bun-express-ws
const express = require(`express`)
const expressWs = require(`bun-express-ws`)
const {app, wsRoute} = expressWs(express())
app.ws(`/abc`, (ws, req) => {
// const {params, query} = req
ws.send(`abc`)
})
app.get(`/abc`, (req, res) => {
res.json(`abc`)
})
app.listen(3040)
- For more examples see the file: test.js
License
Copyright (c) 2023-present, hugeblank