diff --git a/internal/server/rpc/gateway_rpc_servlet_handlers.go b/internal/server/rpc/gateway_rpc_servlet_handlers.go index fb86dae..4cf870b 100644 --- a/internal/server/rpc/gateway_rpc_servlet_handlers.go +++ b/internal/server/rpc/gateway_rpc_servlet_handlers.go @@ -24,6 +24,17 @@ type GatewayRPCServletHandlers struct { } func (sh *GatewayRPCServletHandlers) Invoke(servletCTX rpc.ServletContext, requestCodec protocol.RegistryCodec) (result interface{}, err error) { + defer func () { + if nil != err { + logging.Logger().Errorf("Gateway Websocket: Inovke error %v", err) + } + + if !requestCodec.HasResponse() { + result = nil + err = nil + } + } + md := servletCTX.GetAttribute(oogw.GRPCMetadataKey) if nil == md { md = metadata.Pairs( @@ -36,23 +47,31 @@ func (sh *GatewayRPCServletHandlers) Invoke(servletCTX rpc.ServletContext, reque grpcCTX := metadata.NewOutgoingContext(context.Background(), md.(metadata.MD)) - params, err := requestCodec.Params() + var ( + grpcResult string + params []string + ) + + params, err = requestCodec.Params() if nil != err { - return nil, err + return } - r, err := grpc.Exec(grpcCTX, requestCodec.Method(), params) + grpcResult, err = grpc.Exec(grpcCTX, requestCodec.Method(), params) if err != nil { - return nil, err + return } - var m interface{} - err = json.Unmarshal([]byte(r), &m) + if !requestCodec.HasResponse() { + return + } + + err = json.Unmarshal([]byte(grpcResult), &result) if err != nil { - return nil, err + return } - return m, nil + return } func (sh *GatewayRPCServletHandlers) Validate() { diff --git a/internal/server/rpc/rpc_gateway_servlet_handlers.go b/internal/server/rpc/rpc_gateway_servlet_handlers.go index 30b1973..a8f1a95 100644 --- a/internal/server/rpc/rpc_gateway_servlet_handlers.go +++ b/internal/server/rpc/rpc_gateway_servlet_handlers.go @@ -70,8 +70,6 @@ func (sh *RPCGatewayServletHandlers) Handle(soc cwf.Socket, stopChan <-chan stru var err error rpcServlet := retainRPCServlet(sh.gwRPCSH, sh.rpcRWCSH) - // rpcServlet := cRPC.NewServlet(sh.gwRPCSH, sh.rpcRWCSH) - defer func() { rpcServlet.Stop() releaseRPCServlet(rpcServlet)