From 416485400c46eec9a93e65944b56d952f8f2bb33 Mon Sep 17 00:00:00 2001 From: jsvisa Date: Fri, 13 Oct 2023 10:41:12 +0000 Subject: [PATCH] rpc: use custom struct instead Signed-off-by: jsvisa --- rpc/subscription.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/rpc/subscription.go b/rpc/subscription.go index 947767e963..5589aa5f6f 100644 --- a/rpc/subscription.go +++ b/rpc/subscription.go @@ -177,13 +177,17 @@ func (n *Notifier) activate() error { } func (n *Notifier) send(sub *Subscription, data interface{}) error { - params, _ := json.Marshal(struct { + params := struct { ID string `json:"subscription"` Result interface{} `json:"result,omitempty"` - }{ID: string(sub.ID), Result: data}) + }{ID: string(sub.ID), Result: data} ctx := context.Background() - msg := &jsonrpcMessage{ + msg := struct { + Version string `json:"jsonrpc,omitempty"` + Method string `json:"method,omitempty"` + Params interface{} `json:"params,omitempty"` + }{ Version: vsn, Method: n.namespace + notificationMethodSuffix, Params: params,