streaming-events-1.0.1: Client-side consumption of a ServerEvent.

CopyrightCopyright © 2019 Kadena LLC.
LicenseBSD-3-Clause
MaintainerColin Woodbury <colin@kadena.io>
Safe HaskellNone
LanguageHaskell2010

Network.Wai.EventSource.Streaming

Contents

Description

Client-side consumption of the ServerEvent type from wai-extra via the streaming ecosystem.

Synopsis

ServerEvent Stream

withEvents :: Request -> Manager -> (Stream (Of ServerEvent) IO () -> IO a) -> IO a Source #

A low-level wrapper around withResponse. Provides a simple, unending source of ServerEvents, presumably from an endpoint served via eventSourceAppIO or otherwise.

Since: 1.0.0

Auto-conversion of ServerEvents

class FromEvent a where Source #

Convert a ServerEvent's data field into some type.

Since: 1.0.1

dataOnly :: (FromEvent a, Monad m) => Stream (Of ServerEvent) m r -> Stream (Of a) m r Source #

A stream of only the data fields of each consumed ServerEvent. Assumes that each data field contains bytes of identical format, i.e. decodable by FromEvent. Silently skips over decoding failures.

Attoparsec Parser

event :: Parser ServerEvent Source #

The underlying attoparsec Parser.

Since: 1.0.0