Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BroadcastMsg ¶
type BroadcastMsg struct { ModelID string `json:"model_id"` MsgType model.BroadcastMsgType `json:"msg_type"` Msg []byte `json:"msg"` }
type SwitcherI ¶
type SwitcherI interface { // 向所有的节点广播消息 Broadcast(modelID string, msg *BroadcastMsg) error // 广播到指定的peer BroadcastToPeer(modelID string, msg *BroadcastMsg, p *Peer) error // 广播 除了指定的peer BroadcastExceptPeer(modelID string, msg *BroadcastMsg, p *Peer) error // 移除某个peer RemovePeer(p *Peer) error RegisterOnReceive(modelID string, callBack OnReceive) error Start() error // 返回所有存在的peers Peers() ([]*Peer, error) }
Click to show internal directories.
Click to hide internal directories.