Analytics for action response times
- Any user calls
ping
action. - Listening users respond with
pong
using the transaction ID. - Response times are recorded in
pings
table in terms of block number.
# ping
cleos push action pingpong.sx ping '["myping"]' -p myaccount
# pong
cleos push action pingpong.sx pong '["myaccount", "0311bad192115ef75abe1208330d2370a409a62a00fdb7140ef6fdf15931ef76"]' -p myaccount
network | contract |
---|---|
EOS | pingpong.sx |
BOS | pingpong.sx |
WAX | pingpong.sx |
Jungle2 | eosnpingpong |
Jungle3 | eosnpingpong |
Kylin | eosnpingpong |
WAX Test | eosnpingpong |
BOS Test | eosnpingpong |
$ eosio-cpp pingpong.sx.cpp -o pingpong.sx.wasm
$ cleos set contract pingpong.sx . pingpong.sx.wasm pingpong.sx.abi
param |
index_position |
key_type |
---|---|---|
name |
2 | i64 |
timestamp |
3 | i64 |
{uint64_t} uid
- [primary key] unique identifier{name} name
- ping name (allows easy to filter using secondary index){name} sender
- name of account that sent current inline action{time_point} timestamp
- timestamp when ping was executed{name} first
- first account to respond to ping{map<name, int64_t>} pongs
- transactions with their response time in block numbers (500ms per block){checksum256} trx_id
- transaction ID
{
"uid": 123,
"name": "myping",
"sender": "mysender",
"timestamp": "2020-04-21T17:12:51.500",
"first": "myaccount",
"pongs": [ { "key": "f370a9bf27c659ee7c5ff9226dfe612420a261a91a14c15c244d067077fbea24", "value": 3 } ] ,
"trx_id": "0311bad192115ef75abe1208330d2370a409a62a00fdb7140ef6fdf15931ef76"
}
Ping alerts users to replay with pong
- authority:
any
{name} [name=null]
- (optional) name of ping (allows filtering by name)
cleos push action pingpong.sx ping '["myping"]' -p myaccount
Pong replies to ping
- authority:
account
{name} account
- account replying to ping{uint64_t} [trx_id=null]
- (optional) transaction ID of ping (default to latest ping)
$ cleos push action pingpong.sx pong '["myaccount", "02154c4be85e915117b3170782a7d30c41ec9772b8518d5608089fbcbc86c491"]' -p myaccount
$ cleos push action pingpong.sx pong '["myaccount", null]' -p myaccount
Deletes pings that are older than 1 hour (maximum of 2 per clear action)
- authority:
any
$ cleos push action pingpong.sx clear '[]' -p myaccount