-
Notifications
You must be signed in to change notification settings - Fork 186
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
[@hono/node-ws] ReferenceError: ErrorEvent is not defined #784
Comments
@JeromeDeLeon Thank you for the issue. @nakasyou Can you take a look? |
There are two ways to close this I think.
From spec, onerror can use both of Reference: |
Since While we're at it, can I also request to change the type of the The -import type { Server } from 'node:http'
-import type { Http2SecureServer, Http2Server } from 'node:http2'
+import { ServerType } from '@hono/node-server'
export interface NodeWebSocket {
- upgradeWebSocket: UpgradeWebSocket
+ upgradeWebSocket: UpgradeWebSocket<WebSocket>
- injectWebSocket(server: Server | Http2Server | Http2SecureServer): void
+ injectWebSocket(server: ServerType): void
} |
I'm using Node.js
v22.10.0
with@hono/node-ws v1.0.4
and when listening to theonError
event it throws the following error:My workaround is to use
undici
package and import that event from there.I'm checking if that event exists because I thought it was unavailable to Node.js - https://developer.mozilla.org/en-US/docs/Web/API/ErrorEvent#browser_compatibility.
I managed to test it via
The text was updated successfully, but these errors were encountered: