websocket

package
v1.5.3 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2019 License: LGPL-3.0 Imports: 15 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package websocket privides websocket server handler

Index

Constants

View Source
const (
	WSTOPIC_EVENT      = 1
	WSTOPIC_JSON_BLOCK = 2
	WSTOPIC_RAW_BLOCK  = 3
	WSTOPIC_TXHASHS    = 4
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

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

type WsServer

type WsServer struct {
	sync.RWMutex
	Upgrader websocket.Upgrader

	SessionList  *session.SessionList // websocket sesseionlist
	ActionMap    map[string]Handler   //handler functions
	TxHashMap    map[string]string    //key: txHash   value:sessionid
	SubscribeMap map[string]subscribe //key: sessionId   value:subscribeInfo
	// contains filtered or unexported fields
}

func InitWsServer

func InitWsServer() *WsServer

init websocket server

func (*WsServer) BroadcastToSubscribers

func (self *WsServer) BroadcastToSubscribers(contractAddrs map[string]bool, sub int, resp map[string]interface{})

func (*WsServer) InsertTxHashMap

func (self *WsServer) InsertTxHashMap(txhash string, sessionid string)

func (*WsServer) IsValidMsg

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

func (*WsServer) OnDataHandle

func (self *WsServer) OnDataHandle(curSession *session.Session, bysMsg []byte, r *http.Request) bool

func (*WsServer) PushTxResult

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

func (*WsServer) Restart

func (self *WsServer) Restart()

func (*WsServer) Start

func (self *WsServer) Start() error

start websocket server

func (*WsServer) Stop

func (self *WsServer) Stop()

Jump to

Keyboard shortcuts

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