websocket_fasthttp/socket_context.go

29 lines
490 B
Go
Raw Normal View History

2017-11-27 11:19:19 +00:00
package websocket_fasthttp
import (
cuc "git.loafle.net/commons_go/util/context"
)
type SocketContext interface {
cuc.Context
ServerContext() ServerContext
}
2017-11-27 11:35:39 +00:00
func NewSocketContext(serverCTX ServerContext) SocketContext {
2017-11-27 11:19:19 +00:00
sCTX := &socketContext{}
sCTX.Context = cuc.NewContext(serverCTX)
sCTX.serverCTX = serverCTX
return sCTX
}
type socketContext struct {
cuc.Context
serverCTX ServerContext
}
func (sc *socketContext) ServerContext() ServerContext {
return sc.serverCTX
}