4

I'm trying to enable streaming via the REST API but it doesn't seem to be working.

curl -H "Accept: text/event-stream" "https://horizon-testnet.stellar.org/payments"

This curl statement only returns a list of payments but it doesn't stream any.

Even the stellar tools explorer isn't working when put in stream mode...

https://www.stellar.org/laboratory/#explorer?resource=operations&endpoint=all&values=eyJzdHJlYW1pbmciOnRydWUsIm9yZGVyIjoiZGVzYyIsImxpbWl0IjoiMTAwIn0%3D&network=public

Am I doing something wrong here?

2 Answers 2

1

Stream is closed with 200 OK status after sending a specific number of events (as far as I remember: 10 events). Curl does not implement Server-Sent Events specification correctly. According to SSE spec client should reconnect to the stream if connection was closed.

Another issue with your request is that you did not pass cursor parameter. In such case Horizon will stream events from the oldest so the first payments that were submitted to the network a few years ago. Add cursor=now to stream recent payments.

0

Streaming mode is working just fine. Try code samples from official docs.

However, curl doesn't work as expected for some reason. I checked the specification, curl has support of Server Sent Events (format used by Horizon API). So it seems to me that Horizon server does not fully support the protocol. Try to use one of Stellar SDKs instead.

1
  • Using one of the Stellar SDKs is not viable as there is none for the language I'm using. Every attempt to consume SSE sent by Horizon fails, but but the same code is able to consume SSE's sent by other sources just fine, so i'm a bit confused...
    – Riina
    Commented May 26, 2018 at 14:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.