1 Star 0 Fork 0

毕升Office / go-socket.io

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
namespace_handlers.go 574 Bytes
一键复制 编辑 原始数据 按行查看 历史
Saimon Shaplygin 提交于 2021-05-07 16:35 . ref: socketio
package socketio
import "sync"
type namespaceHandlers struct {
handlers map[string]*namespaceHandler
mu sync.RWMutex
}
func newNamespaceHandlers() *namespaceHandlers {
return &namespaceHandlers{
handlers: make(map[string]*namespaceHandler),
}
}
func (h *namespaceHandlers) Set(namespace string, handler *namespaceHandler) {
h.mu.Lock()
defer h.mu.Unlock()
h.handlers[namespace] = handler
}
func (h *namespaceHandlers) Get(nsp string) (*namespaceHandler, bool) {
h.mu.RLock()
defer h.mu.RUnlock()
handler, ok := h.handlers[nsp]
return handler, ok
}
1
https://gitee.com/ibisheng/go-socket.io.git
git@gitee.com:ibisheng/go-socket.io.git
ibisheng
go-socket.io
go-socket.io
f22f23ac6ef8

搜索帮助