Documentation
¶
Index ¶
- type Hub
- func (h *Hub) Broadcast(data any)
- func (h *Hub) HandleSSE(w http.ResponseWriter, r *http.Request, userID int64) error
- func (h *Hub) HandleWebSocket(w http.ResponseWriter, r *http.Request, userID int64) error
- func (h *Hub) MaxConnectionsPerUser() int
- func (h *Hub) PushMessage(userID int64, data any) error
- func (h *Hub) PushMessageWaitAck(userID int64, data any, timeout time.Duration) PushAckResult
- func (h *Hub) Stats() Stats
- func (h *Hub) SubscribeInbound(handler func(InboundMessage)) func()
- func (h *Hub) Transport() Transport
- type InboundMessage
- type PushAckResult
- type Stats
- type Transport
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Hub ¶
type Hub struct {
// contains filtered or unexported fields
}
func (*Hub) Broadcast ¶ added in v0.2.4
Broadcast 把同一条消息推给所有在线连接(跨用户),用于与用户无关的全局事件 (例如「容器队列发生了变化」这种所有在线客户端都该刷新的通知)。
与 PushMessage 不同,没有在线连接不算错误:广播本身就是尽力而为。
func (*Hub) HandleWebSocket ¶
func (*Hub) MaxConnectionsPerUser ¶
func (*Hub) PushMessageWaitAck ¶
func (*Hub) SubscribeInbound ¶
func (h *Hub) SubscribeInbound(handler func(InboundMessage)) func()
type InboundMessage ¶
type PushAckResult ¶
Click to show internal directories.
Click to hide internal directories.