Skip to content

Support URL path in WebSocket connections#23

Merged
lukasz-zimnoch merged 5 commits intomainfrom
path-api-key
Mar 3, 2026
Merged

Support URL path in WebSocket connections#23
lukasz-zimnoch merged 5 commits intomainfrom
path-api-key

Conversation

@pdyraga
Copy link
Member

@pdyraga pdyraga commented Mar 2, 2026

Some Electrum providers require path-based API keys in the WebSocket URL (e.g. wss://host:port/api-key). The library previously constructed URLs as protocol://host:port, discarding any path component.

Add an optional path parameter to the constructor chain (ElectrumClient -> SocketClient -> WebSocketClient) and append it to the WebSocket URL. The parameter is backwards-compatible and defaults to an empty string. TCP/SSL clients are unaffected since paths are only meaningful for WebSocket connections.

Update integration tests to use mainnet servers and support path-based authentication via the ELECTRUM_API_KEY env variable.

Some Electrum providers require path-based API keys in the WebSocket
URL (e.g. wss://host:port/api-key). The library previously constructed
URLs as protocol://host:port, discarding any path component.

Add an optional `path` parameter to the constructor chain
(ElectrumClient -> SocketClient -> WebSocketClient) and append it to
the WebSocket URL. The parameter is backwards-compatible and defaults
to an empty string. TCP/SSL clients are unaffected since paths are
only meaningful for WebSocket connections.

Update integration tests to use mainnet servers and support
path-based authentication via the ELECTRUMX_API_KEY env variable.
@pdyraga pdyraga requested a review from nkuba March 2, 2026 19:58
pdyraga added 4 commits March 3, 2026 07:57
Node 14 is EOL and actions/setup-node@v2 cache protocol is no
longer supported by GitHub, causing "Cache service responded with
400" errors.
No changes to the logic, just linting.
Not all Electrum servers will be ElectrumX. Renaming for clarity.
Repository secrets need to be explicitly mapped to environment variables
via env: — they aren't injected into process.env automatically.
The ${{ secrets.ELECTRUM_API_KEY }} expression reads the secret and
exposes it as the ELECTRUM_API_KEY env var for the test step.
@lukasz-zimnoch lukasz-zimnoch merged commit 29751db into main Mar 3, 2026
2 checks passed
@lukasz-zimnoch lukasz-zimnoch deleted the path-api-key branch March 3, 2026 10:15
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