diff --git a/handler/web/web.go b/handler/web/web.go index 564f010..5095833 100644 --- a/handler/web/web.go +++ b/handler/web/web.go @@ -19,8 +19,8 @@ type WebHandler interface { } type webHandler struct { - co *gws.SocketOptions - ho *jsonrpc.Options + so *gws.SocketOptions + ro *jsonrpc.Options handler gws.MessageHandler pool grpcPool.Pool } @@ -30,14 +30,14 @@ func New(pool grpcPool.Pool) WebHandler { pool: pool, } - h.ho = &jsonrpc.Options{ + h.ro = &jsonrpc.Options{ OnRequest: h.onRequest, OnNotify: h.onNotify, } - h.handler = jsonrpc.NewHandler(h.ho) + h.handler = jsonrpc.NewHandler(h.ro) - h.co = &gws.SocketOptions{ + h.so = &gws.SocketOptions{ Handler: h.handler, } @@ -45,7 +45,7 @@ func New(pool grpcPool.Pool) WebHandler { } func (h *webHandler) GetSocketOption() *gws.SocketOptions { - return h.co + return h.so } func (h *webHandler) onRequest(soc gws.Socket, method string, params []string) (interface{}, error) { @@ -56,6 +56,7 @@ func (h *webHandler) onRequest(soc gws.Socket, method string, params []string) ( log.Println("cannot retrive GRPC Client") return nil, err } + defer h.pool.Put(c) sm := strings.Split(method, ".")