Documentation ¶
Index ¶
- type Hub
- func (h *Hub) AddClient(channels []string, conn *websocket.Conn)
- func (h *Hub) DiffChannelMap(oldChannelMap map[string]bool, newChannels []string) (removeChannelMap map[string]bool, addChannelMap map[string]bool)
- func (h *Hub) GetChannels() []string
- func (h *Hub) HandlerDynamicChannel() func(w http.ResponseWriter, r *http.Request)
- func (h *Hub) HandlerStaticChannels(channels []string) func(w http.ResponseWriter, r *http.Request)
- func (h *Hub) RemoveClient(conn *websocket.Conn)
- func (h *Hub) UpdateSubChannels()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Hub ¶
type Hub struct { ClientMap map[*websocket.Conn]map[string]bool SubFunc func(patterns ...string) error UnSubFunc func(patterns ...string) error // contains filtered or unexported fields }
Hub 接收redis数据并用websocket推送的server 支持channel不固定,订阅多个channel
func NewHub ¶
NewHub ..
func (*Hub) AddClient ¶
AddClient 新增客户端
func (*Hub) DiffChannelMap ¶
func (h *Hub) DiffChannelMap(oldChannelMap map[string]bool, newChannels []string) (removeChannelMap map[string]bool, addChannelMap map[string]bool)
DiffChannelMap channelMap比较
func (*Hub) HandlerDynamicChannel ¶
func (h *Hub) HandlerDynamicChannel() func(w http.ResponseWriter, r *http.Request)
HandlerDynamicChannel 向websocket推送mq数据,可以变更channel
func (*Hub) HandlerStaticChannels ¶
HandlerStaticChannels 向websocket推送mq数据,不可变更channel
Click to show internal directories.
Click to hide internal directories.