MCPcopy Create free account
hub / github.com/CPChain/chain / handleNotification

Method handleNotification

api/rpc/client.go:629–645  ·  view source on GitHub ↗
(msg *jsonrpcMessage)

Source from the content-addressed store, hash-verified

627}
628
629func (c *Client) handleNotification(msg *jsonrpcMessage) {
630 if !strings.HasSuffix(msg.Method, notificationMethodSuffix) {
631 log.Debug("dropping non-subscription message", "msg", msg)
632 return
633 }
634 var subResult struct {
635 ID string `json:"subscription"`
636 Result json.RawMessage `json:"result"`
637 }
638 if err := json.Unmarshal(msg.Params, &subResult); err != nil {
639 log.Debug("dropping invalid subscription message", "msg", msg)
640 return
641 }
642 if c.subs[subResult.ID] != nil {
643 c.subs[subResult.ID].deliver(subResult.Result)
644 }
645}
646
647func (c *Client) handleResponse(msg *jsonrpcMessage) {
648 op := c.respWait[string(msg.ID)]

Callers 1

dispatchMethod · 0.95

Calls 2

DebugMethod · 0.80
deliverMethod · 0.45

Tested by

no test coverage detected