Closed jopmiddelkamp closed 11 months ago
Hi @jopmiddelkamp, thank you for reporting this issue. I guess your code is running on a mobile phone within an app? Is the app still open?
First came across this on my mobile phone as my code didn't work as intended.. Found out the stream somehow only worked for a couple of minutes.. Then to be sure I setup the example that you can see above in a Dart executable that I run on my MacBook. Same result only in my Flutter app it did not crash the app but it seems to crash the Dart executable. But only if the connection is idle for a while, if I push a couple of payments directly after the application runs it shows them correctly but then when I wait a couple of minutes and then push a payment then it seems to crash.
ok, I will check it with a test case. I asked because, as I know, if the app goes to the background streaming dose not work any more. In this case one must listen on the server side and send a push notification to the app.
I guess that the server closes the stream.
Following payments using curl:
$ curl -H "Accept: text/event-stream" "https://horizon-testnet.stellar.org/accounts/GAVMXA2LAJWG5ZXXABCVXO5KZ3HU23C3EE3XO2RJ7SPAHSN5JLIWFXUV/payments"
see: https://developers.stellar.org/docs/tutorials/follow-received-payments
after 1 minute
Yes I know, pushing notifications is still on our list of TODO's but so far have not gotten to that point yet. Not too far out anymore :) I think I'll write a temp workaround for this till we implement the push notifications.
But makes me wonder why is the JavaScript SDK version not closing after one minute..
fixed in release 1.5.7
The payment stream only works for a short amount of time.. If I open the stream and I execute 4 payments in a row one after another it shows all the 4 transactions. But if I wait for a couple of minutes the executable of the code example below just crashes/stops working.
When listening to the stream via laboratory and the JavaScript SDK everything works fine. They both keep the connection open for as long as I wish tried 10 minutes even and it was no problem the transactions still showed up. Only somehow the Dart stream seems to crash or quit..
Dart code (not working when starting, waiting a couple of minutes and then execute a transaction):
JavaScript (working fine even after its been idle for 10 minutes+):