-
Notifications
You must be signed in to change notification settings - Fork 38
Open
Labels
documentationImprovements or additions to documentationImprovements or additions to documentationenhancementNew feature or requestNew feature or request
Description
Environment
NodeJS - v20.11.1
H3 - v1.11.1
Reproduction
https://github.com/joshmossas/h3-ws-listhen-bug
Describe the bug
If you start an h3 server like so:
listen(toNodeListener(app), {
ws: true,
public: true,
});None of the websocket hooks in defineWebSocketHandler will fire. Oddly enough, clients are still able to connect and send messages. So listhen is upgrading the connection, but for some reason none of the hooks go off meaning you can't actually send messages back.
If you refactor the code to use the listhen cli. It starts working again:
// index.ts
export default app;listhen ./index.ts --ws --publicAdditional context
I'm unsure if the bug is happening on the H3 side or the Listhen side. I did try digging through both code bases for a while and couldn't figure out what was causing this behavior.
Logs
No response
Metadata
Metadata
Assignees
Labels
documentationImprovements or additions to documentationImprovements or additions to documentationenhancementNew feature or requestNew feature or request