Documentation
¶
Overview ¶
Package ws 提供 WebSocket 实时双向通信能力: 连接管理(Hub)、广播、业务消息回调与心跳保活。 标准 http.Handler 实现,可配合 iris.FromStd 或直接用于 net/http。
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client 表示一个 WebSocket 连接。
type Hub ¶
type Hub struct {
// contains filtered or unexported fields
}
Hub 管理全部 WebSocket 客户端。 消息处理通过 onMessage 回调注入;广播用 Broadcast。
func (*Hub) Handle ¶
func (h *Hub) Handle(w http.ResponseWriter, r *http.Request)
Handle 是标准 WebSocket 升级处理器。 用法:http.Handle("/ws", hub.Handle) 或 app.Get("/ws", iris.FromStd(hub.Handle))
Click to show internal directories.
Click to hide internal directories.