server

package
v1.1.7-beta Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2020 License: Apache-2.0 Imports: 31 Imported by: 2

Documentation

Index

Constants

View Source
const (
	TlsPort = 443
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DelayedChan

type DelayedChan struct {
	// contains filtered or unexported fields
}

func NewDelayedChan

func NewDelayedChan(size int, delay time.Duration) *DelayedChan

func (*DelayedChan) Pop

func (dc *DelayedChan) Pop() (interface{}, bool)

func (*DelayedChan) Push

func (dc *DelayedChan) Push(v interface{}) bool

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

type WsServer

type WsServer struct {
	sync.RWMutex
	Upgrader websocket.Upgrader

	SessionList *session.SessionList
	ActionMap   map[string]Handler
	TxHashMap   map[string]string //key: txHash   value:sessionid
	// contains filtered or unexported fields
}

func InitWsServer

func InitWsServer(localNode *node.LocalNode, wallet vault.Wallet) *WsServer

func (*WsServer) Broadcast

func (ws *WsServer) Broadcast(data []byte) error

func (*WsServer) GetClientsById

func (ws *WsServer) GetClientsById(cliendID []byte) []*session.Session

func (*WsServer) GetNetNode

func (ws *WsServer) GetNetNode() *node.LocalNode

func (*WsServer) IsValidMsg

func (ws *WsServer) IsValidMsg(reqMsg map[string]interface{}) bool

func (*WsServer) NotifyWrongClients

func (ws *WsServer) NotifyWrongClients()

func (*WsServer) OnDataHandle

func (ws *WsServer) OnDataHandle(curSession *session.Session, messageType int, bysMsg []byte, r *http.Request) error

func (*WsServer) PushResult

func (ws *WsServer) PushResult(resp map[string]interface{})

func (*WsServer) PushTxResult

func (ws *WsServer) PushTxResult(txHashStr string, resp map[string]interface{})

func (*WsServer) Restart

func (ws *WsServer) Restart()

func (*WsServer) SetTxHashMap

func (ws *WsServer) SetTxHashMap(txhash string, sessionid string)

func (*WsServer) Start

func (ws *WsServer) Start() error

func (*WsServer) Stop

func (ws *WsServer) Stop()

Jump to

Keyboard shortcuts

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