Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(node-ws): Added missing WSContext raw type #940

Merged
merged 4 commits into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions packages/node-ws/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,16 @@
"devDependencies": {
"@hono/node-server": "^1.11.1",
"@types/ws": "^8",
"hono": "^4.2.9",
"hono": "^4.6.17",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think 4.6.0 is okay, that can support the generics for upgradeWebSocket.

"tsup": "^8.0.1",
"vitest": "^1.0.4"
},
"dependencies": {
"ws": "^8.17.0"
},
"peerDependencies": {
"@hono/node-server": "^1.11.1"
"@hono/node-server": "^1.11.1",
"hono": "^4.6.17"
},
"engines": {
"node": ">=18.14.1"
Expand Down
4 changes: 2 additions & 2 deletions packages/node-ws/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import type { Http2SecureServer, Http2Server } from 'node:http2'
import { CloseEvent } from './events'

export interface NodeWebSocket {
upgradeWebSocket: UpgradeWebSocket
upgradeWebSocket: UpgradeWebSocket<WebSocket>
injectWebSocket(server: Server | Http2Server | Http2SecureServer): void
}
export interface NodeWebSocketInit {
Expand Down Expand Up @@ -73,7 +73,7 @@ export const createNodeWebSocket = (init: NodeWebSocketInit): NodeWebSocket => {
const events = await createEvents(c)
const ws = await nodeUpgradeWebSocket(c.env.incoming)

const ctx: WSContext = {
const ctx: WSContext<WebSocket> = {
binaryType: 'arraybuffer',
close(code, reason) {
ws.close(code, reason)
Expand Down
Loading