Here is the sample subscription message for get_actions endpoint:
{
"apikey":"test-api-key",
"event":"subscribe",
"type":"get_actions",
"data": {
"account":"eostribeprod",
“actions":[“transfer”,”buyram”]
}
}
import json
from websocket import create_connection
path="streaming"
url = "wss://testnet.telos.eostribe.io/"+path
actionsList = ["transfer","buyram"]
data = {"account":"eostribeprod"}
messageBody = {
"apikey":"test-api-key",
"event":"subscribe",
"type":"get_actions",
"data": data
}
ws = create_connection(url)
messageJson = json.dumps(messageBody)
ws.send(messageJson)
while True:
response = ws.recv()
print(response)
ws.close()
Request message format for get_blocks endpoint:
{
"apikey":"test-api-key",
"event":"subscribe",
"type":"get_blocks"
}
import json
import pprint
from websocket import create_connection
path="streaming"
url = "wss://testnet.telos.eostribe.io/"+path
messageBody = {
"apikey":"test-api-key",
"event":"subscribe",
"type":"get_blocks"
}
ws = create_connection(url)
ws.send(json.dumps(messageBody))
while True:
pprint.pprint(json.loads(ws.recv()))
ws.close()