This commit is contained in:
crusader 2017-12-01 17:12:09 +09:00
parent 51bbdb4429
commit 9c0a3b06a5
3 changed files with 10 additions and 10 deletions

View File

@ -35,6 +35,12 @@ type RPCGatewayServletHandlers struct {
gwRPCHandler rpc.GatewayRPCHandler gwRPCHandler rpc.GatewayRPCHandler
} }
func (sh *RPCGatewayServletHandlers) SocketContext(serverCTX cwf.ServerContext) cwf.SocketContext {
socketCTX := sh.ServletHandlers.SocketContext(serverCTX)
return newServletContext(socketCTX)
}
func (sh *RPCGatewayServletHandlers) Init(serverCTX cwf.ServerContext) error { func (sh *RPCGatewayServletHandlers) Init(serverCTX cwf.ServerContext) error {
if err := sh.ServletHandlers.Init(serverCTX); nil != err { if err := sh.ServletHandlers.Init(serverCTX); nil != err {
return err return err
@ -47,14 +53,8 @@ func (sh *RPCGatewayServletHandlers) Init(serverCTX cwf.ServerContext) error {
return nil return nil
} }
func (sh *RPCGatewayServletHandlers) Handshake(serverCTX cwf.ServerContext, ctx *fasthttp.RequestCtx) (id string, extensionsHeader *fasthttp.ResponseHeader) { func (sh *RPCGatewayServletHandlers) Handshake(socketCTX cwf.SocketContext, ctx *fasthttp.RequestCtx) (id string, extensionsHeader *fasthttp.ResponseHeader) {
return sh.gwRPCHandler.Handshake(serverCTX, ctx) return sh.gwRPCHandler.Handshake(socketCTX, ctx)
}
func (sh *RPCGatewayServletHandlers) SocketContext(serverCTX cwf.ServerContext) cwf.SocketContext {
socketCTX := sh.ServletHandlers.SocketContext(serverCTX)
return newServletContext(socketCTX)
} }
// OnConnect invoked when client is connected // OnConnect invoked when client is connected

View File

@ -8,7 +8,7 @@ import (
type GatewayRPCHandler interface { type GatewayRPCHandler interface {
Init(serverCTX cwf.ServerContext) error Init(serverCTX cwf.ServerContext) error
Handshake(serverCTX cwf.ServerContext, ctx *fasthttp.RequestCtx) (id string, extensionsHeader *fasthttp.ResponseHeader) Handshake(socketCTX cwf.SocketContext, ctx *fasthttp.RequestCtx) (id string, extensionsHeader *fasthttp.ResponseHeader)
Validate() Validate()
} }

View File

@ -12,7 +12,7 @@ func (sh *GatewayRPCHandlers) Init(serverCTX cwf.ServerContext) error {
return nil return nil
} }
func (sh *GatewayRPCHandlers) Handshake(serverCTX cwf.ServerContext, ctx *fasthttp.RequestCtx) (id string, extensionsHeader *fasthttp.ResponseHeader) { func (sh *GatewayRPCHandlers) Handshake(socketCTX cwf.SocketContext, ctx *fasthttp.RequestCtx) (id string, extensionsHeader *fasthttp.ResponseHeader) {
return "", nil return "", nil
} }