增加关闭hub

This commit is contained in:
2025-09-09 19:11:08 +08:00
parent 8d639d3b09
commit 43befdb71c
2 changed files with 18 additions and 0 deletions

View File

@@ -75,6 +75,10 @@ func (s *Server) Start() {
go s.hub.Run()
}
func (s *Server) Stop() {
s.hub.Close()
}
// readPump 从WebSocket连接读取消息
func (c *Client) readPump() {
defer func() {