diff --git a/server/server_handler.go b/server/server_handler.go index 5ff336d..fc65b7e 100644 --- a/server/server_handler.go +++ b/server/server_handler.go @@ -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) } diff --git a/server/server_handlers.go b/server/server_handlers.go index ff9c3ed..b849356 100644 --- a/server/server_handlers.go +++ b/server/server_handlers.go @@ -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 }