This commit is contained in:
crusader 2017-11-14 16:47:29 +09:00
parent f3ea7a8fed
commit f762f59aef
2 changed files with 10 additions and 10 deletions

View File

@ -10,7 +10,7 @@ import (
type ServerHandler interface {
cwf.ServerHandler
RegisterServlet(entryPath string, servletHandler servlet.ServletHandler)
RegisterRPCGatewayServlet(entryPath string, rpcGatewayHandler rpc.RPCGatewayHandler) servlet.ServletHandler
RegisterServlet(servletName string, servletHandler servlet.ServletHandler)
RegisterRPCGatewayServlet(servletName string, rpcGatewayHandler rpc.RPCGatewayHandler) servlet.ServletHandler
RegisterSubscriber(subscriberHandler oos.SubscriberHandler)
}

View File

@ -67,10 +67,10 @@ func (sh *ServerHandlers) OnStop() {
sh.ServerHandlers.OnStop()
}
func (sh *ServerHandlers) RegisterServlet(entryPath string, servletHandler servlet.ServletHandler) {
cfg := config.Config.Servlets[entryPath]
func (sh *ServerHandlers) RegisterServlet(servletName string, servletHandler servlet.ServletHandler) {
cfg := config.Config.Servlets[servletName]
if nil == cfg {
logging.Logger().Panic(fmt.Sprintf("Gateway Websocket: config of entry path[%s] is not exist", entryPath))
logging.Logger().Panic(fmt.Sprintf("Gateway Websocket: config of servlet[%s] is not exist", servletName))
return
}
@ -84,14 +84,14 @@ func (sh *ServerHandlers) RegisterServlet(entryPath string, servletHandler servl
servletH.PingPeriod = cfg.Socket.PingPeriod * time.Second
// servletH.BinaryMessage = cfg.Socket.BinaryMessage
sh.RegisterSocketHandler(entryPath, servletH)
sh.RegisterSocketHandler(cfg.Entry, servletH)
}
func (sh *ServerHandlers) RegisterRPCGatewayServlet(entryPath string, rpcGatewayHandler rpc.RPCGatewayHandler) servlet.ServletHandler {
cfg := config.Config.Servlets[entryPath]
func (sh *ServerHandlers) RegisterRPCGatewayServlet(servletName string, rpcGatewayHandler rpc.RPCGatewayHandler) servlet.ServletHandler {
cfg := config.Config.Servlets[servletName]
if nil == cfg {
logging.Logger().Panic(fmt.Sprintf("Gateway Websocket: config of entry path[%s] is not exist", entryPath))
logging.Logger().Panic(fmt.Sprintf("Gateway Websocket: config of servlet[%s] is not exist", servletName))
return nil
}
@ -105,7 +105,7 @@ func (sh *ServerHandlers) RegisterRPCGatewayServlet(entryPath string, rpcGateway
rpcSHs.PingTimeout = cfg.Socket.PingTimeout * time.Second
rpcSHs.PingPeriod = cfg.Socket.PingPeriod * time.Second
sh.RegisterSocketHandler(entryPath, rpcSHs)
sh.RegisterSocketHandler(cfg.Entry, rpcSHs)
return rpcSH
}