Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions rpc/client_example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
// In this example, our client wishes to track the latest 'block number'
// known to the server. The server supports two methods:
//
// eth_getBlockByNumber("latest", {})
// eth_getBlockByNumber("latest", false)
// returns the latest block object.
//
// eth_subscribe("newHeads")
Expand All @@ -40,7 +40,11 @@ type Block struct {

func ExampleClientSubscription() {
// Connect the client.
client, _ := rpc.Dial("ws://127.0.0.1:8545")
client, err := rpc.Dial("ws://127.0.0.1:8545")
if err != nil {
fmt.Println("dial error:", err)
return
}
subch := make(chan Block)

// Ensure that subch receives the latest block.
Expand Down