Documentation ¶
Index ¶
Constants ¶
View Source
const ( TypeBroadcast = "type_broadcast" TypeOneOnOne = "type_one_on_one" TypeOneToMany = "type_one_to_many" TypeManyToMany = "type_many_to_many" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Manager ¶
type Manager struct {
Clients cmap.ConcurrentMap
}
func InitManager ¶
func InitManager() *Manager
type ParserHandler ¶
type ParserHandler func(c *Client, msg interface{})
type Protocol ¶
type Protocol interface { Register(protocol int64, t interface{}, handler ParserHandler) Receive(c *Client, msg []byte) error Send(c *Client, msg SubscriberBody) error }
Protocol 协议接口
type Server ¶
type Server struct { Manager *Manager Protocol Protocol Subscriber Subscriber }
func InitServer ¶
func InitServer(protocol Protocol, Subscriber Subscriber) *Server
type Subscriber ¶
type Subscriber interface { Conn() Destroy() Producer(c *Client, message SubscriberMessage) Consumer(server *Server) }
Subscriber 订阅器接口
type SubscriberBody ¶
type SubscriberBody struct { Protocol int64 Data interface{} Condition interface{} }
type SubscriberMessage ¶
type SubscriberMessage struct { Type string Body SubscriberBody }
Click to show internal directories.
Click to hide internal directories.