Add HTTP headers to WebSocket connections - #44
Merged
Conversation
yukibtc
approved these changes
Jul 23, 2026
Contributor
Author
|
Thanks, shall I leave it with you intergrate it into NostrDevKit? |
Member
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. |
Member
|
@DanConwayDev, FYI, this repo is now available also on nostr |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
connect_with_headersfor 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 proxyconnections.
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-Agentduring the upgrade handshake.