| 627 | } |
| 628 | |
| 629 | func (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 | |
| 647 | func (c *Client) handleResponse(msg *jsonrpcMessage) { |
| 648 | op := c.respWait[string(msg.ID)] |