Skip to content

Commit

Permalink
WS: add defer ws client close
Browse files Browse the repository at this point in the history
  • Loading branch information
gagliardetto committed Oct 23, 2021
1 parent ece94fc commit e8d45b2
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions rpc/ws/examples/accountSubscribe/accountSubscribe.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ func main() {
if err != nil {
panic(err)
}
defer client.Close()
program := solana.MustPublicKeyFromBase58("9xQeWvG816bUx9EPjHmaT23yvVM2ZWbrrpZb9PusVFin") // serum

{
Expand Down
1 change: 1 addition & 0 deletions rpc/ws/examples/logsSubscribe/logsSubscribe.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ func main() {
if err != nil {
panic(err)
}
defer client.Close()
program := solana.MustPublicKeyFromBase58("9xQeWvG816bUx9EPjHmaT23yvVM2ZWbrrpZb9PusVFin") // serum

{
Expand Down
1 change: 1 addition & 0 deletions rpc/ws/examples/programSubscribe/programSubscribe.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ func main() {
panic(err)
}
program := solana.MustPublicKeyFromBase58("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA") // token
defer client.Close()

sub, err := client.ProgramSubscribeWithOpts(
program,
Expand Down
1 change: 1 addition & 0 deletions rpc/ws/examples/rootSubscribe/rootSubscribe.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ func main() {
if err != nil {
panic(err)
}
defer client.Close()

sub, err := client.RootSubscribe()
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions rpc/ws/examples/signatureSubscribe/signatureSubscribe.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ func main() {
if err != nil {
panic(err)
}
defer client.Close()

txSig := solana.MustSignatureFromBase58("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")

Expand Down
1 change: 1 addition & 0 deletions rpc/ws/examples/slotSubscribe/slotSubscribe.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ func main() {
if err != nil {
panic(err)
}
defer client.Close()

sub, err := client.SlotSubscribe()
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions rpc/ws/examples/voteSubscribe/voteSubscribe.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ func main() {
if err != nil {
panic(err)
}
defer client.Close()

// NOTE: this subscription must be enabled by the node you're connecting to.
// This subscription is disabled by default.
Expand Down

0 comments on commit e8d45b2

Please sign in to comment.