Categorygithub.com/TransferChain/tcabci-read-go-client
modulepackage
1.2.12
Repository: https://github.com/transferchain/tcabci-read-go-client.git
Documentation: pkg.go.dev

# README

TCABCI Read Node Go WebSocket Client

Go Report Card

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

Installation

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

Example

Subscribe, Listen and Unsubscribe Example

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")

	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()
}

Thanks

Websocket client code referenced here https://github.com/webdeveloppro/golang-websocket-client.

License

tcabci-read-go-client is licensed under the Apache License, Version 2.0. See LICENSE for the full license text.

# Functions

NewClient make ws client.
NewClientContext make ws client with context.

# Constants

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Subscribe message.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Unsubscribe message.

# Variables

No description provided by the author
ErrNoConnected ..
No description provided by the author
No description provided by the author

# Structs

No description provided by the author
No description provided by the author
Bytea transaction byte data.
No description provided by the author
Message ..
Received message.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Transaction read node transaction model.

# Interfaces

Client TCABCI Read Node Websocket Client.

# Type aliases

No description provided by the author
MessageType ..
No description provided by the author
No description provided by the author