ws

package
v0.0.0-...-13d5c5d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 21, 2018 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BCHBalance

type BCHBalance struct {
	Confirmed   float64 `json:"confirmed"`
	Unconfirmed float64 `json:"unconfirmed"`
}

type CoinType

type CoinType string
const (
	CoinBch      CoinType = "BCH"
	CoinWormhole CoinType = "Wormhole"
)

type ConnMgr

type ConnMgr struct {
	MsgChan chan Message
	// contains filtered or unexported fields
}

func NewConnMgr

func NewConnMgr() *ConnMgr

func (*ConnMgr) GetConnForAddress

func (c *ConnMgr) GetConnForAddress(addr string) (*Connection, bool)

func (*ConnMgr) Notify

func (c *ConnMgr) Notify()

Notify serves the client for the relative addresses's balance for connection. Ignore the unknown address's messages only to log it. The client will be closed immediately if writing to client failed. The client should be reconnect to the server with all the specified addresses in the account.

type Connection

type Connection struct {
	Conn *websocket.Conn

	// for websocket trace log
	Uid string

	QuitMutex sync.Mutex
	Quit      chan struct{}
	// contains filtered or unexported fields
}

func NewConnection

func NewConnection(mgr *ConnMgr, conn *websocket.Conn, uid string) *Connection

func (*Connection) AddAddrs

func (conn *Connection) AddAddrs(addrs []string)

AddAddrs only accept bech32 encoded address

func (*Connection) Close

func (conn *Connection) Close()

Close should be only called by ConnMgr in order to maintain the ConnMgr state and data.

func (*Connection) DelAddr

func (conn *Connection) DelAddr(addrs []string)

AddAddrs only accept bech32 encoded address

type Message

type Message struct {
	Address string      `json:"address"`
	Balance interface{} `json:"balance"`
	Symbol  CoinType    `json:"symbol"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL