Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Determine how we should handle streaming end points #52

Open
choubacha opened this issue Mar 21, 2018 · 7 comments
Open

Determine how we should handle streaming end points #52

choubacha opened this issue Mar 21, 2018 · 7 comments
Labels
enhancement New feature or request help wanted Extra attention is needed question Further information is requested

Comments

@choubacha
Copy link
Owner

Stellar has the ability to hold a stable connection and stream events as they occur. I'm not sure where we need this functionality yet but we need to devise how we can handle this in the client:
https://www.stellar.org/developers/horizon/reference/responses.html#streaming

I believe that hyper supports the event-stream content type, but I'm not sure how it does it. I'm also not sure we need it in our server implementation and we can delay implementation until it's needed.

@choubacha choubacha added enhancement New feature or request help wanted Extra attention is needed question Further information is requested labels Mar 21, 2018
@choubacha
Copy link
Owner Author

One solution that doesn't use streaming would be to implement an InfiniteIter that doesn't terminate when nothing is returned, but instead sleeps and then re-queries. It could be modeled after the current Iter./

@robertDurst
Copy link
Collaborator

Cool, checked out the repeat method for iter: https://doc.rust-lang.org/std/iter/fn.repeat.html

Is the idea here to basically poll an endpoint, sort of like I do for the meetup bot here: https://github.com/robertDurst/tipmebch/blob/master/meetup_bot/src/meetup/stellar/mod.rs#L14

@robertDurst
Copy link
Collaborator

Any more thoughts here? Once I finish #215 I'd be interested in this since I may not be much help w/ XDR.

Started working in Go SDK @work and here is how it does streaming:
https://github.com/stellar/go/blob/master/clients/horizon/client.go#L298

@choubacha
Copy link
Owner Author

choubacha commented Jun 6, 2018

@robertDurst That actually kinda makes me think that it doesn't work with an open connection, seems like it's just the SSE format that's it providing.

My issue with it is that I can't seem to keep the connection open, but maybe i wasn't at the end of the cursor?

@robertDurst
Copy link
Collaborator

To confirm, it doesn't continuously ping? It instead opens a connection and continuously receives a stream of data?

Do you have an example? I was messing around with reqwest yesterday.

@choubacha
Copy link
Owner Author

Oh, I had an example at one point. It made the first request but didn't keep streaming content. The go implementation appears to loop making a new request each time. Maybe it hangs on the connection when you are at the last cursor?

@robertDurst
Copy link
Collaborator

Hmmm... not quite sure. Will give a closer look

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants