Documentation ¶
Index ¶
- Constants
- Variables
- func DeleteIDs(ids map[float64]*websocket.Conn, id float64) map[float64]*websocket.Conn
- func DeleteSlice(res []*websocket.Conn, s *websocket.Conn) []*websocket.Conn
- func DeleteSubs(subs map[string]*websocket.Conn, c *websocket.Conn) map[string]*websocket.Conn
- func GetConnection(addr string) (*rpcclient.HTTP, error)
- func GetEthConnection(addr string) (*websocket.Conn, error)
- func GetURL(host string) (error, *util.DomainInfo)
- func IsValidMessage(msg []byte) bool
- func Notify(r *PubSubRoom, topic string, m SendMessage)
- func SetDefaultPort(tmport, shardport, ethport string)
- type ClientError
- type Description
- type ErrorResponse
- type EthSubcribeMsg
- type Instance
- type Job
- type LBPolicy
- type MessageContent
- type NewRequestParams
- type Proxy
- type ProxyType
- type PubSubRoom
- func (r *PubSubRoom) AddShard()
- func (r PubSubRoom) GetBackends() []Instance
- func (r *PubSubRoom) GetPubSubRoom()
- func (r *PubSubRoom) HandleEthSub()
- func (r *PubSubRoom) HandleSubscribe(topic string, c *websocket.Conn)
- func (r *PubSubRoom) HandleUnsubscribe(topic string, c *websocket.Conn)
- func (r *PubSubRoom) HandleUnsubscribeAll(c *websocket.Conn)
- func (r *PubSubRoom) HasClientConnect() bool
- func (r *PubSubRoom) HasEthConnections() bool
- func (r *PubSubRoom) HasTMConnections() bool
- func (r *PubSubRoom) Receive(c *websocket.Conn)
- func (r *PubSubRoom) ReceiveEth(c *websocket.Conn)
- func (r *PubSubRoom) RemoveAllEthConnections()
- func (r *PubSubRoom) RemoveAllTMConnections(err error)
- func (r *PubSubRoom) RemoveEthConnection(c *websocket.Conn, err error)
- func (r *PubSubRoom) SetBackends(bs []Instance)
- func (r *PubSubRoom) SetEthConnections() (err error)
- func (r *PubSubRoom) SetTMConnections() (err error)
- func (r *PubSubRoom) Subscribe(topic string)
- func (r *PubSubRoom) Unsubscribe(topic string)
- type ReceiveMessage
- type RequestParams
- type ResultRep
- type SendMessage
- type ServerSource
- type TMResponse
Constants ¶
View Source
const ( LBType = "lb" ConcretType = "concret" FilterType = "filter" DeployType = "deploy" LB = LBType Concret = ConcretType Filter = FilterType Deploy = DeployType ValidCode int = 200 ErrGetErrorResponse uint32 = 101 ErrUnmarshalFailed uint32 = 102 )
View Source
const ( DefaultSubscribeMethod = "subscribe" DefaultUnsubscribeMethod = "unsubscribe" DefaultUnsubscribeAllMethod = "unsubscribe_all" DefaultWSEndpoint = "/websocket" )
Variables ¶
View Source
var ( EthPort string ShardPort string TMPort string )
Functions ¶
func DeleteSubs ¶ added in v1.5.30
func IsValidMessage ¶
func Notify ¶
func Notify(r *PubSubRoom, topic string, m SendMessage)
func SetDefaultPort ¶
func SetDefaultPort(tmport, shardport, ethport string)
Types ¶
type ClientError ¶
type ClientError struct { Error interface{} `json:"error"` Connect *websocket.Conn `json:"connect"` }
func NewServerError ¶
func NewServerError(r interface{}, c *websocket.Conn) ClientError
type Description ¶
type ErrorResponse ¶
type ErrorResponse struct { Ret interface{} `json:"ret"` Data interface{} `json:"data"` Message string `json:"message"` }
type EthSubcribeMsg ¶
type MessageContent ¶
type MessageContent struct { Method string `json:"method"` Args []Description `json:"args"` }
func (MessageContent) CommandType ¶
func (msg MessageContent) CommandType() string
func (MessageContent) GetTopic ¶
func (msg MessageContent) GetTopic() string
func (MessageContent) IsUnsubscribeAll ¶
func (msg MessageContent) IsUnsubscribeAll() bool
type NewRequestParams ¶
type NewRequestParams struct {
Data interface{} `json:"data"`
}
type PubSubRoom ¶
type PubSubRoom struct { RemoteClients []*websocket.Conn ConnMap map[string][]*websocket.Conn Connections map[string]*rpcclient.HTTP EthConnections map[string]*websocket.Conn Mutex sync.Mutex IDs map[float64]*websocket.Conn Subs map[string]*websocket.Conn MaxConnections int // contains filtered or unexported fields }
func (*PubSubRoom) AddShard ¶
func (r *PubSubRoom) AddShard()
func (PubSubRoom) GetBackends ¶
func (r PubSubRoom) GetBackends() []Instance
func (*PubSubRoom) GetPubSubRoom ¶
func (r *PubSubRoom) GetPubSubRoom()
func (*PubSubRoom) HandleEthSub ¶ added in v1.5.30
func (r *PubSubRoom) HandleEthSub()
func (*PubSubRoom) HandleSubscribe ¶
func (r *PubSubRoom) HandleSubscribe(topic string, c *websocket.Conn)
func (*PubSubRoom) HandleUnsubscribe ¶
func (r *PubSubRoom) HandleUnsubscribe(topic string, c *websocket.Conn)
func (*PubSubRoom) HandleUnsubscribeAll ¶
func (r *PubSubRoom) HandleUnsubscribeAll(c *websocket.Conn)
func (*PubSubRoom) HasClientConnect ¶
func (r *PubSubRoom) HasClientConnect() bool
func (*PubSubRoom) HasEthConnections ¶
func (r *PubSubRoom) HasEthConnections() bool
func (*PubSubRoom) HasTMConnections ¶
func (r *PubSubRoom) HasTMConnections() bool
func (*PubSubRoom) Receive ¶
func (r *PubSubRoom) Receive(c *websocket.Conn)
func (*PubSubRoom) ReceiveEth ¶
func (r *PubSubRoom) ReceiveEth(c *websocket.Conn)
func (*PubSubRoom) RemoveAllEthConnections ¶
func (r *PubSubRoom) RemoveAllEthConnections()
func (*PubSubRoom) RemoveAllTMConnections ¶
func (r *PubSubRoom) RemoveAllTMConnections(err error)
func (*PubSubRoom) RemoveEthConnection ¶
func (r *PubSubRoom) RemoveEthConnection(c *websocket.Conn, err error)
func (*PubSubRoom) SetBackends ¶
func (r *PubSubRoom) SetBackends(bs []Instance)
func (*PubSubRoom) SetEthConnections ¶
func (r *PubSubRoom) SetEthConnections() (err error)
func (*PubSubRoom) SetTMConnections ¶
func (r *PubSubRoom) SetTMConnections() (err error)
func (*PubSubRoom) Subscribe ¶
func (r *PubSubRoom) Subscribe(topic string)
func (*PubSubRoom) Unsubscribe ¶
func (r *PubSubRoom) Unsubscribe(topic string)
type ReceiveMessage ¶
type ReceiveMessage struct { Time string `json:"time"` //time Content MessageContent `json:"content"` //content表示消息内容,这里简化别的消息 }
client端消息结构
func (ReceiveMessage) String ¶
func (msg ReceiveMessage) String() string
type RequestParams ¶
type RequestParams struct { Proxy string `json:"proxy"` Data interface{} `json:"data"` }
type SendMessage ¶
type SendMessage struct { Time string `json:"time"` //time Content interface{} `json:"content"` //content表示消息内容,这里简化别的消息 }
Server端消息结构
type ServerSource ¶
type ServerSource interface {
FetchSource() []string
}
type TMResponse ¶
type TMResponse struct {
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.