Server-sent events with the best and finalized block
curl --request GET \
--url https://api.floprouter.com/v1/blocks/streamconst options = {method: 'GET'};
fetch('https://api.floprouter.com/v1/blocks/stream', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.floprouter.com/v1/blocks/stream"
response = requests.get(url)
print(response.text)retry: 5000
data: {"best_block":4510004,"finalized_block":4510000,"ts":1764000000000}
data: {"best_block":4510005,"finalized_block":4510001,"ts":1764000001000}
: keep-alive
{
"error": {
"code": 503,
"message": "too many block streams are open; retry shortly",
"metadata": {
"reason": "too_many_streams"
}
}
}Service
Server-sent events with the best and finalized block
Pushes the chain’s head as it moves, so a client does not poll. No key needed. The first event is sent at once, then one per new block (events within about 40 ms are merged). Each event is data: {"best_block": n, "finalized_block": n, "ts": ms} (ts is the server time in Unix milliseconds). A : keep-alive comment is sent every 15 seconds. The stream starts with retry: 5000, the reconnect delay for EventSource. The server holds at most 500 streams open; past that it answers 503 too_many_streams with Retry-After: 10. Block time is block_time_ms in /health.
GET
/
v1
/
blocks
/
stream
Server-sent events with the best and finalized block
curl --request GET \
--url https://api.floprouter.com/v1/blocks/streamconst options = {method: 'GET'};
fetch('https://api.floprouter.com/v1/blocks/stream', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.floprouter.com/v1/blocks/stream"
response = requests.get(url)
print(response.text)retry: 5000
data: {"best_block":4510004,"finalized_block":4510000,"ts":1764000000000}
data: {"best_block":4510005,"finalized_block":4510001,"ts":1764000001000}
: keep-alive
{
"error": {
"code": 503,
"message": "too many block streams are open; retry shortly",
"metadata": {
"reason": "too_many_streams"
}
}
}Response
An event stream (text/event-stream)
The response is of type string.