可配置是否存储连接
This commit is contained in:
@ -137,7 +137,7 @@ func NewWebsocketServe(wsInstanceList ...abstract.IWebsocket) error {
|
||||
ctx := ctxInterface.(*context.WSContext)
|
||||
ctx.Session = session
|
||||
if err := wsInstance.Connect(ctx); nil == err {
|
||||
if nil != storage.Connection {
|
||||
if ginRouterTable[wsInstance.GetServerPort()].conf.StoreConnection && nil != storage.Connection {
|
||||
storage.Connection.Store(ctx)
|
||||
}
|
||||
}
|
||||
@ -154,7 +154,7 @@ func NewWebsocketServe(wsInstanceList ...abstract.IWebsocket) error {
|
||||
ctxInterface, _ := session.Get("ws_context")
|
||||
ctx := ctxInterface.(*context.WSContext)
|
||||
defer func() {
|
||||
if nil == storage.Connection {
|
||||
if !ginRouterTable[wsInstance.GetServerPort()].conf.StoreConnection || nil == storage.Connection {
|
||||
return
|
||||
}
|
||||
storage.Connection.Del(ctx)
|
||||
|
Reference in New Issue
Block a user