> For the complete documentation index, see [llms.txt](https://docs.transferchain.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.transferchain.io/blockchain-read-node/websocket-client/go.md).

# GO

TCABCI Read Node Go WebSocket Client

TransferChain Fastest Read Network WebSocket Client\
Read Node Address: <https://read-node-01.transferchain.io>\
Read Node WebSocket Address: wss\://read-node-01.transferchain.io/ws

### Networks

* medusa - v2

### Installation

```bash
$ go get github.com/TransferChain/tcabci-read-go-client 
```

### Example

**Subscribe, Listen and Unsubscribe Example**

```go
package main

import (
	"log"
	tcabcireadgoclient "github.com/TransferChain/tcabci-read-go-client"
)

func main() {
	readNodeClient, _ := tcabcireadgoclient.NewClient("https://read-node-01.transferchain.io", "wss://read-node-01.transferchain.io/ws", "medusa", "v2")

	if err := readNodeClient.Start(); err != nil {
		log.Fatal(err)
    }
	
	addresses := []string{
		"<your-public-address-one>",
		"<your-public-address-two>",
	}

	if err := readNodeClient.Subscribe(addresses); err != nil {
		log.Fatal(err)
	}

	done := make(chan struct{})
	// If a transaction has been sent to your addresses, the callback you set here will be called.
	readNodeClient.SetListenCallback(func(transaction *tcabcireadgoclient.Transaction) {
		// 
		done <- struct{}{}
	})
	
	<-done
	close(done)

	_ = readNodeClient.Unsubscribe()
	readNodeClient.Stop()
}
```
