|
@@ -573,11 +573,6 @@ func (h *Hub) GetRandOneWithTimeout(filter FilterFunc, cmd string, data any, tim
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-// 推送消息出去,不需要返回数据
|
|
|
|
|
-func (h *Hub) Push(filter FilterFunc, cmd string, data any) {
|
|
|
|
|
- h.PushWithMax(filter, cmd, data, 0)
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
// 推送最大对应数量的消息出去,不需要返回数据
|
|
// 推送最大对应数量的消息出去,不需要返回数据
|
|
|
func (h *Hub) PushWithMax(filter FilterFunc, cmd string, data any, max int) {
|
|
func (h *Hub) PushWithMax(filter FilterFunc, cmd string, data any, max int) {
|
|
|
// 排除空频道
|
|
// 排除空频道
|
|
@@ -595,6 +590,18 @@ func (h *Hub) PushWithMax(filter FilterFunc, cmd string, data any, max int) {
|
|
|
h.sendRequest(gd)
|
|
h.sendRequest(gd)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+// 推送消息出去,不需要返回数据
|
|
|
|
|
+func (h *Hub) Push(filter FilterFunc, cmd string, data any) {
|
|
|
|
|
+ h.PushWithMax(filter, cmd, data, 0)
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+// 推送消息到多个频道
|
|
|
|
|
+func (h *Hub) Pushs(filters []FilterFunc, cmd string, data any) {
|
|
|
|
|
+ for _, filter := range filters {
|
|
|
|
|
+ h.PushWithMax(filter, cmd, data, 0)
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
// 增加连接
|
|
// 增加连接
|
|
|
func (h *Hub) addLine(line *Line) {
|
|
func (h *Hub) addLine(line *Line) {
|
|
|
if h.lines.Exist(line) {
|
|
if h.lines.Exist(line) {
|