github.com/palcoin-project/palcd@v1.0.0/rpcclient/examples/btcdwebsockets/README.md (about)

     1  btcd Websockets Example
     2  =======================
     3  
     4  This example shows how to use the rpcclient package to connect to a btcd RPC
     5  server using TLS-secured websockets, register for block connected and block
     6  disconnected notifications, and get the current block count.
     7  
     8  This example also sets a timer to shutdown the client after 10 seconds to
     9  demonstrate clean shutdown.
    10  
    11  ## Running the Example
    12  
    13  The first step is to use `go get` to download and install the rpcclient package:
    14  
    15  ```bash
    16  $ go get github.com/btcsuite/btcd/rpcclient
    17  ```
    18  
    19  Next, modify the `main.go` source to specify the correct RPC username and
    20  password for the RPC server:
    21  
    22  ```Go
    23  	User: "yourrpcuser",
    24  	Pass: "yourrpcpass",
    25  ```
    26  
    27  Finally, navigate to the example's directory and run it with:
    28  
    29  ```bash
    30  $ cd $GOPATH/src/github.com/btcsuite/btcd/rpcclient/examples/btcdwebsockets
    31  $ go run *.go
    32  ```
    33  
    34  ## License
    35  
    36  This example is licensed under the [copyfree](http://copyfree.org) ISC License.