Skip to content

feat: first class support for websockets#328

Open
BlankParticle wants to merge 5 commits intohonojs:v2from
BlankParticle:blank/feat/built-in-websockets
Open

feat: first class support for websockets#328
BlankParticle wants to merge 5 commits intohonojs:v2from
BlankParticle:blank/feat/built-in-websockets

Conversation

@BlankParticle
Copy link
Copy Markdown

@BlankParticle BlankParticle commented Mar 20, 2026

fixes #307

There was some discussion around how we should do this, but it died down
I landed on a design that doesn't add any extra runtime dependency, the user needs to provide the websocket server themselves, which is a good compromise.

I am opening this PR so we can do discussion around this and easily reason about this,
this is not the final design and I will update this PR accordingly to the reviews/comments to better fit the goal

code was ported and adapted from @hono/node-ws

@BlankParticle BlankParticle marked this pull request as draft March 20, 2026 07:39
@BlankParticle BlankParticle force-pushed the blank/feat/built-in-websockets branch from f6892a1 to 6ea41a5 Compare March 20, 2026 07:42
@BlankParticle BlankParticle marked this pull request as ready for review March 20, 2026 07:43
@yusukebe
Copy link
Copy Markdown
Member

yusukebe commented Apr 5, 2026

Hey @BlankParticle

Sorry for being late. I think the direction of this PR is good! So, can you finalize this, or is this ready for review?

I'd like to include this change to the next major version v2: #316

@BlankParticle
Copy link
Copy Markdown
Author

BlankParticle commented Apr 5, 2026

This version is ready for review where you need to provide your own websocket server.
I was wondering if you have considered having ws as peer dependency as @nakasyou said would be fine in #307
else this PR is good to go

@yusukebe
Copy link
Copy Markdown
Member

yusukebe commented Apr 5, 2026

@BlankParticle

Simple question. If you add ws as peerDependencies, the user should install ws even though they don't use WebSocket? If so, adding ws to peerDependencies is not necessary; only adding docs is better, I think.

@BlankParticle
Copy link
Copy Markdown
Author

BlankParticle commented Apr 5, 2026

this design works then, users will need to pass in their own server,
this is also better for use cases like if you have a ws compatible library or you want to pass in an existing server like in a vite plugin

this PR is ready to go

@yusukebe
Copy link
Copy Markdown
Member

yusukebe commented Apr 5, 2026

@BlankParticle Okay!

Hey @nakasyou can you review this? (We don't need to add ws to peerDependencies).

@yusukebe yusukebe added the v2 label Apr 5, 2026
Copy link
Copy Markdown
Contributor

@nakasyou nakasyou left a comment

Choose a reason for hiding this comment

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

It looks great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants