Closed ovibos closed 7 years ago
Even nicer would be an API using futures.
In my IRC client, I've settled for having the iterator in a separate thread, and sending every item through a channel. Futures would be nice to have at some point, but this works well for now.
I'm going to start experimenting with a new version using Tokio. This should address this issue and #62 concurrently.
With the new 0.12.0 release, we use tokio internally and present two methods of processing messages: a synchronous one (for_each_incoming
) that behaves much like the old iterator approach and an asynchronous one (a standard futures::Stream
) which you can use however you'd like. I'm interested in hearing feedback about use of the latter approach.
Currently the only way to check for messages on a Server is to get an Iterator from
iter()
and then callnext()
on it, which blocks forever. It would be nice if there was an alternate way to poll for new messages which allowed for a timeout, or some other method of preventing indefinite blocking.