Skip to content

Add HTTP headers to WebSocket connections - #44

Merged
yukibtc merged 2 commits into
shadowylab:masterfrom
DanConwayDev:pr/connect_with_headers
Jul 23, 2026
Merged

Add HTTP headers to WebSocket connections#44
yukibtc merged 2 commits into
shadowylab:masterfrom
DanConwayDev:pr/connect_with_headers

Conversation

@DanConwayDev

Copy link
Copy Markdown
Contributor

Adds connect_with_headers for native WebSocket connections.

Callers can now attach HTTP headers to the WebSocket upgrade request, including
a User-Agent. The headers are applied for both direct and SOCKS proxy
connections.

This allows downstream clients such as rust-nostr to connect to relays behind
HTTP infrastructure that rejects headerless WebSocket upgrades, as reported in
the ngit issue:

https://gitworkshop.dev/danconwaydev.com/ngit/issues/nevent1qqsgplqk3lqna25j5pc8lz47hpyw6a4mknje6eyy8n68wjqfy0e76gq3qvucm

Tests cover request construction and verify a local WebSocket server receives
the supplied User-Agent during the upgrade handshake.

@yukibtc
yukibtc merged commit 5f52ff6 into shadowylab:master Jul 23, 2026
4 checks passed
@DanConwayDev

Copy link
Copy Markdown
Contributor Author

Thanks, shall I leave it with you intergrate it into NostrDevKit?

@yukibtc

yukibtc commented Jul 23, 2026

Copy link
Copy Markdown
Member

Thanks, shall I leave it with you intergrate it into NostrDevKit?

Feel free to work on it. I’m a bit busy in this period, but if you open a PR, I’ll try to review and merge it as soon as possible.

@yukibtc

yukibtc commented Jul 23, 2026

Copy link
Copy Markdown
Member

@DanConwayDev, FYI, this repo is now available also on nostr

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants