[Haskell-cafe] HTTP client library supporting Server sent events ?

Gregory Collins greg at gregorycollins.net
Wed Apr 29 13:20:32 UTC 2015


On Wed, Apr 29, 2015 at 6:07 AM, Alexandre Mazari <scaroo at gmail.com> wrote:

> In an effort to build an Haskell client library for the Firebase service
> [0], which rely heavily on HTTP event source/server sent events [1], I am
> looking for an HTTP client lib supporting this spec.
>
> AFAIK, both WAI and yesod handle the mechanism server-side but nor
> http-client, wreq or http-streams seem to provide the client counterpart.
>
> Am I looking in the wrong direction?
>

At least http-client and http-streams should support this use case easily,
you'll just have to parse the stream yourself. The easiest way is to write
a parser using attoparsec and lift that into a stream transformer. The
io-streams library has native support for this (
http://hackage.haskell.org/package/io-streams-1.3.0.0/docs/System-IO-Streams-Attoparsec.html#v:parserToInputStream),
conduits supply a similar thing in the conduit-extra package.

Greg
-- 
Gregory Collins <greg at gregorycollins.net>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20150429/cda280fd/attachment.html>


More information about the Haskell-Cafe mailing list