keep-network / go-electrum

A pure Go ElectrumX JSON-RPC library.
MIT License
0 stars 10 forks source link

Support WebSocket protocol #2

Closed nkuba closed 1 year ago

nkuba commented 1 year ago

Here we add support for WebSocket protocol. With this change the client will support all connection types defined by the electrum protocol: tcp, ssl, ws and wss.

The WebSocket client initialization expects remote server details to be provided as URL including a scheme and host, e.g. tcp://electrum.io:50001.

Examples of client initialization:

// TCP
client, err := NewClient(ctx, "tcp://electrum.io:50001", nil)
// SSL
client, err := NewClient(ctx, "ssl://electrum.io:50002", nil)
// WS
client, err := NewClient(ctx, "ws://electrum.io:50003", nil)
// WSS
client, err := NewClient(ctx, "wss://electrum.io:50004", nil)
nkuba commented 1 year ago

Sample integration tests can be found in https://github.com/keep-network/keep-core/pull/3582.