2022-01-04 18:59:47 +01:00
|
|
|
# lbcd Websockets Example
|
2022-01-04 18:52:39 +01:00
|
|
|
|
|
|
|
This example shows how to use the rpcclient package to connect to a btcd RPC
|
|
|
|
server using TLS-secured websockets, register for block connected and block
|
|
|
|
disconnected notifications, and get the current block count.
|
|
|
|
|
|
|
|
## Running the Example
|
|
|
|
|
2022-01-04 18:59:47 +01:00
|
|
|
The first step is to clone the lbcd package:
|
2022-01-04 18:52:39 +01:00
|
|
|
|
|
|
|
```bash
|
2022-01-04 18:59:47 +01:00
|
|
|
$ git clone github.com/lbryio/lbcd
|
2022-01-04 18:52:39 +01:00
|
|
|
```
|
|
|
|
|
2022-01-04 18:59:47 +01:00
|
|
|
Next, navigate to the example's directory and modify the `main.go` source to
|
|
|
|
specify the correct RPC username and password for the RPC server:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
$ cd rpcclient/examples/lbcdblocknotify
|
|
|
|
```
|
2022-01-04 18:52:39 +01:00
|
|
|
|
|
|
|
```Go
|
|
|
|
User: "yourrpcuser",
|
|
|
|
Pass: "yourrpcpass",
|
|
|
|
```
|
|
|
|
|
2022-01-04 18:59:47 +01:00
|
|
|
Finally, run it with:
|
2022-01-04 18:52:39 +01:00
|
|
|
|
|
|
|
```bash
|
|
|
|
$ go run .
|
|
|
|
```
|
|
|
|
|
|
|
|
## License
|
|
|
|
|
|
|
|
This example is licensed under the [copyfree](http://copyfree.org) ISC License.
|