支持从 gin router注册长连接地址
This commit is contained in:
parent
726f6b5911
commit
e1061bc921
20
construct.go
20
construct.go
@ -55,6 +55,26 @@ var (
|
|||||||
sigChan = make(chan int, 1)
|
sigChan = make(chan int, 1)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// NewWebsocketServeWithGinRouter ...
|
||||||
|
//
|
||||||
|
// Author : go_developer@163.com<白茶清欢>
|
||||||
|
//
|
||||||
|
// Date : 17:41 2024/7/22
|
||||||
|
func NewWebsocketServeWithGinRouter(ginPort int, ginRouter *gin.Engine, wsInstanceList ...abstract.IWebsocket) error {
|
||||||
|
if len(wsInstanceList) == 0 {
|
||||||
|
return errors.WithStack(errors.New("register websocket server list is empty"))
|
||||||
|
}
|
||||||
|
ginRouterTable = map[int]*gin.Engine{
|
||||||
|
ginPort: ginRouter,
|
||||||
|
}
|
||||||
|
wsServerTable = make(map[int]map[string]*Server)
|
||||||
|
commandTable = make(map[string]map[string]abstract.ICommand)
|
||||||
|
for _, wsInstance := range wsInstanceList {
|
||||||
|
initServer(wsInstance)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// NewWebsocketServe 启动websocket服务
|
// NewWebsocketServe 启动websocket服务
|
||||||
//
|
//
|
||||||
// Author : go_developer@163.com<白茶清欢>
|
// Author : go_developer@163.com<白茶清欢>
|
||||||
|
Loading…
Reference in New Issue
Block a user