mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-06-09 15:46:43 +00:00
Websockets Example
This example shows how to use the rpcclient package to connect to an RPC server using TLS-secured websockets, register for block connected and block disconnected notifications, and get the current block count.
This example also sets a timer to shutdown the client after 10 seconds to demonstrate clean shutdown.
Modify the main.go
source to specify the correct RPC username and
password for the RPC server:
User: "yourrpcuser",
Pass: "yourrpcpass",
Finally, navigate to the example's directory and run it with:
$ cd $GOPATH/src/github.com/kaspanet/kaspad/rpcclient/examples/websockets
$ go run *.go