status-go/services/subscriptions
frank 38308d48f2
feat_: log on panic (#5849)
* feat_: log error and stacktrace when panic in goroutine

* test_: add test TestSafeGo

* chore_: rename logAndCall to call

* chore_: rename SafeGo to Go

* chore_: make lint-fix

* chore_: use t.Cleanup

* chore_: Revert "chore_: use t.Cleanup"

This reverts commit 4eb420d179cc0e208e84c13cb941e6b3d1ed9819.

* chore_: Revert "chore_: make lint-fix"

This reverts commit fcc995f157e671a4229b47419c3a0e4004b5fdab.

* chore_: Revert "chore_: rename SafeGo to Go"

This reverts commit a6d73d6df583f313032d79aac62f66328039cb55.

* chore_: Revert "chore_: rename logAndCall to call"

This reverts commit 8fbe993bedb9fbba67349a44f151e2dd5e3bc4cc.

* chore_: Revert "test_: add test TestSafeGo"

This reverts commit a1fa91839f3960398980c6bf456e6462ec944819.

* chore_: Revert "feat_: log error and stacktrace when panic in goroutine"

This reverts commit f612dd828fa2ce410d0e806fe773ecbe3e86a68a.

* feat_: log error and stacktrace when panic in goroutine

* chore_: make lint-fix

* chore_: rename logAndCall to call

* chore_: renaming LogOnPanic

* chore_: update rest goroutine function calls

* chore_: make lint-fix
2024-09-27 06:37:32 +08:00
..
README.md Implement subscription for eth and shh filters using signals. (#1455) 2019-05-07 09:05:38 +02:00
api.go Avoid passing node to subscriptions service 2020-01-20 13:15:17 +01:00
filters.go Implement subscription for eth and shh filters using signals. (#1455) 2019-05-07 09:05:38 +02:00
filters_eth.go feat: Rpc client manage multiple eth client (#2359) 2021-09-22 13:49:20 -04:00
filters_shh.go feat: Rpc client manage multiple eth client (#2359) 2021-09-22 13:49:20 -04:00
service.go Fix wallet big int conversion 2021-07-20 10:57:38 +02:00
signals.go Implement subscription for eth and shh filters using signals. (#1455) 2019-05-07 09:05:38 +02:00
subscription.go Fix race condition in subscriptions (#1646) 2019-12-11 09:44:57 +01:00
subscriptions.go feat_: log on panic (#5849) 2024-09-27 06:37:32 +08:00
subscriptions_test.go Use goimports instead of gofmt 2020-01-06 10:17:23 +01:00

README.md

Signal Subscriptions

This package implements subscriptions mechanics using signal package.

It defines 3 new RPC methods in the eth namespace and 2 signals.

Methods

###eth_subscribeSignal Creates a new filter and subscribes to its changes via signals.

Parameters: receives the method name and parameters for the filter that is created.

Example 1:

{
  "jsonrpc": "2.0", 
  "id": 1,
  "method": "eth_subscribeSignal", 
  "params": ["eth_newPendingTransactionFilter", []]
}

Example 2:

{
  "jsonrpc": "2.0", 
  "id": 2,
  "method": "eth_subscribeSignal", 
  "params": [
    "shh_newMessageFilter",
    [{ "symKeyID":"abcabcabcabc", "topics": ["0x12341234"] }]
  ]
}

Supported filters: shh_newMessageFilter, eth_newFilter, eth_newBlockFilter, eth_newPendingTransactionFilter (see Ethereum documentation for respective parameters).

Returns: error or subscriptionID.

###eth_unsubscribeSignal Unsubscribes and removes one filter by its ID. NOTE: Unsubscribing from a filter removes it.

Parameters: subscriptionID obtained from eth_subscribeSignal Returns: error if something went wrong while unsubscribing.

Signals

  1. Subscription data received
{
  "type": "subscriptions.data",
  "event": {
    "subscription_id": "shh_0x01",
    "data": {
        <whisper envelope 01>,
        <whisper envelope 02>,
        ...
    }
}
  1. Subscription error received
{
  "type": "subscriptions.error",
  "event": {
    "subscription_id": "shh_0x01",
    "error_message": "can not find filter with id: 0x01"
  }
}