servant-client-core-0.20.3.0: Core functionality and class for client function generation for servant APIs

Safe Haskell | None
Language | Haskell2010

Servant.Client.Core.ServerSentEvents

Description

Server-sent events

See https://www.w3.org/TR/2009/WD-eventsource-20090421/ for more details on server-sent events (SSE).

Synopsis

- data EventMessage
  - = EventDispatch
  - | EventSetName ByteString
  - | EventSetLastId ByteString
  - | EventData ByteString
  - | EventRetry Natural
  - | EventIgnore EventIgnoreReason
- data EventIgnoreReason
  - = EventFieldNameUnknown ByteString
  - | EventRetryNonNumeric ByteString
  - | EventComment ByteString
- data Event a = Event {
  - eventName :: Maybe ByteString
  - eventData :: a
  }
- newtype EventStreamT (m :: Type -> Type) = EventStreamT {
  - unEventStreamT :: SourceT m (Event ByteString)
  }
- newtype JsonEventStreamT (m :: Type -> Type) a = JsonEventStreamT {
  - unJsonEventStreamT :: SourceT m (Event a)
  }
- newtype EventMessageStreamT (m :: Type -> Type) = EventMessageStreamT {
  - unEventMessageStreamT :: SourceT m EventMessage
  }

# Documentation

data EventMessage Source #

Structured variant of an event line of an event stream

Constructors

EventDispatch | Dispatch on the accumulated event.
EventSetName ByteString | Set the name of the current event.
EventSetLastId ByteString | Set the last event identifier.
EventData ByteString | Append data to the event's data buffer.
EventRetry Natural | Set the event stream's reconnection time.
EventIgnore EventIgnoreReason | Ignored

#### Instances

Instances details

Show EventMessage Source # |
Instance details Defined in Servant.Client.Core.ServerSentEvents Methods showsPrec :: Int -> EventMessage -> ShowS Source # show :: EventMessage -> String Source # showList :: [EventMessage] -> ShowS Source #
Eq EventMessage Source # |
Instance details Defined in Servant.Client.Core.ServerSentEvents Methods (==) :: EventMessage -> EventMessage -> Bool Source # (/=) :: EventMessage -> EventMessage -> Bool Source #
Ord EventMessage Source # |

Instance details

Defined in Servant.Client.Core.ServerSentEvents

Methods

compare :: EventMessage -> EventMessage -> Ordering Source #

(<) :: EventMessage -> EventMessage -> Bool Source #

(<=) :: EventMessage -> EventMessage -> Bool Source #

(>) :: EventMessage -> EventMessage -> Bool Source #

(>=) :: EventMessage -> EventMessage -> Bool Source #

max :: EventMessage -> EventMessage -> EventMessage Source #

min :: EventMessage -> EventMessage -> EventMessage Source #

(RunClient m, HasClient m (SseClientDelegate method status (EventMessageStreamT IO))) => HasClient m (ServerSentEvents' method status 'RawEvent EventMessage) Source # |

Instance details

Defined in Servant.Client.Core.HasClient

Associated Types

type Client m (ServerSentEvents' method status 'RawEvent EventMessage) |
Instance details Defined in Servant.Client.Core.HasClient type Client m (ServerSentEvents' method status 'RawEvent EventMessage)

Methods

clientWithRoute :: Proxy m -> Proxy (ServerSentEvents' method status 'RawEvent EventMessage) -> Request -> Client m (ServerSentEvents' method status 'RawEvent EventMessage) Source #

hoistClientMonad :: Proxy m -> Proxy (ServerSentEvents' method status 'RawEvent EventMessage) -> (forall x. mon x -> mon' x) -> Client mon (ServerSentEvents' method status 'RawEvent EventMessage) -> Client mon' (ServerSentEvents' method status 'RawEvent EventMessage) Source #

type Client m (ServerSentEvents' method status 'RawEvent EventMessage) Source # |
Instance details Defined in Servant.Client.Core.HasClient type Client m (ServerSentEvents' method status 'RawEvent EventMessage)

data EventIgnoreReason Source #

Reason why a event line can be ignored

Constructors

EventFieldNameUnknown ByteString |
EventRetryNonNumeric ByteString |
EventComment ByteString |

#### Instances

Instances details

Show EventIgnoreReason Source # |
Instance details Defined in Servant.Client.Core.ServerSentEvents Methods showsPrec :: Int -> EventIgnoreReason -> ShowS Source # show :: EventIgnoreReason -> String Source # showList :: [EventIgnoreReason] -> ShowS Source #
Eq EventIgnoreReason Source # |
Instance details Defined in Servant.Client.Core.ServerSentEvents Methods (==) :: EventIgnoreReason -> EventIgnoreReason -> Bool Source # (/=) :: EventIgnoreReason -> EventIgnoreReason -> Bool Source #
Ord EventIgnoreReason Source # |

Instance details

Defined in Servant.Client.Core.ServerSentEvents

Methods

compare :: EventIgnoreReason -> EventIgnoreReason -> Ordering Source #

(<) :: EventIgnoreReason -> EventIgnoreReason -> Bool Source #

(<=) :: EventIgnoreReason -> EventIgnoreReason -> Bool Source #

(>) :: EventIgnoreReason -> EventIgnoreReason -> Bool Source #

(>=) :: EventIgnoreReason -> EventIgnoreReason -> Bool Source #

max :: EventIgnoreReason -> EventIgnoreReason -> EventIgnoreReason Source #

min :: EventIgnoreReason -> EventIgnoreReason -> EventIgnoreReason Source #

data Event a Source #

Event sent by the remote

Constructors

Event |

Fields

- eventName :: Maybe ByteString
- eventData :: a

#### Instances

Instances details

Functor Event Source # |
Instance details Defined in Servant.Client.Core.ServerSentEvents Methods fmap :: (a -> b) -> Event a -> Event b Source # (<$) :: a -> Event b -> Event a Source #
(RunClient m, HasClient m (SseClientDelegate method status (EventStreamT IO))) => HasClient m (ServerSentEvents' method status 'RawEvent (Event a)) Source # |

Instance details

Defined in Servant.Client.Core.HasClient

Associated Types

type Client m (ServerSentEvents' method status 'RawEvent (Event a)) |
Instance details Defined in Servant.Client.Core.HasClient type Client m (ServerSentEvents' method status 'RawEvent (Event a))

Methods

clientWithRoute :: Proxy m -> Proxy (ServerSentEvents' method status 'RawEvent (Event a)) -> Request -> Client m (ServerSentEvents' method status 'RawEvent (Event a)) Source #

hoistClientMonad :: Proxy m -> Proxy (ServerSentEvents' method status 'RawEvent (Event a)) -> (forall x. mon x -> mon' x) -> Client mon (ServerSentEvents' method status 'RawEvent (Event a)) -> Client mon' (ServerSentEvents' method status 'RawEvent (Event a)) Source #

Generic (Event a) Source # |

Instance details

Defined in Servant.Client.Core.ServerSentEvents

Associated Types

type Rep (Event a) |

Instance details

Defined in Servant.Client.Core.ServerSentEvents

type Rep (Event a) = D1 ('MetaData "Event" "Servant.Client.Core.ServerSentEvents" "servant-client-core-0.20.3.0-8S9QaOrR0pTLkHAcl21Dlv" 'False) (C1 ('MetaCons "Event" 'PrefixI 'True) (S1 ('MetaSel ('Just "eventName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe ByteString)) :*: S1 ('MetaSel ('Just "eventData") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 a)))

Methods

from :: Event a -> Rep (Event a) x Source #

to :: Rep (Event a) x -> Event a Source #

Show a => Show (Event a) Source # |
Instance details Defined in Servant.Client.Core.ServerSentEvents Methods showsPrec :: Int -> Event a -> ShowS Source # show :: Event a -> String Source # showList :: [Event a] -> ShowS Source #
Eq a => Eq (Event a) Source # |
Instance details Defined in Servant.Client.Core.ServerSentEvents Methods (==) :: Event a -> Event a -> Bool Source # (/=) :: Event a -> Event a -> Bool Source #
Ord a => Ord (Event a) Source # |
Instance details Defined in Servant.Client.Core.ServerSentEvents Methods compare :: Event a -> Event a -> Ordering Source # (<) :: Event a -> Event a -> Bool Source # (<=) :: Event a -> Event a -> Bool Source # (>) :: Event a -> Event a -> Bool Source # (>=) :: Event a -> Event a -> Bool Source # max :: Event a -> Event a -> Event a Source # min :: Event a -> Event a -> Event a Source #
type Client m (ServerSentEvents' method status 'RawEvent (Event a)) Source # |
Instance details Defined in Servant.Client.Core.HasClient type Client m (ServerSentEvents' method status 'RawEvent (Event a))
type Rep (Event a) Source # |

Instance details

Defined in Servant.Client.Core.ServerSentEvents

type Rep (Event a) = D1 ('MetaData "Event" "Servant.Client.Core.ServerSentEvents" "servant-client-core-0.20.3.0-8S9QaOrR0pTLkHAcl21Dlv" 'False) (C1 ('MetaCons "Event" 'PrefixI 'True) (S1 ('MetaSel ('Just "eventName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe ByteString)) :*: S1 ('MetaSel ('Just "eventData") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 a)))

newtype EventStreamT (m :: Type -> Type) Source #

Server-sent event stream (SSE)

See https://www.w3.org/TR/2009/WD-eventsource-20090421/ for more details.

Constructors

EventStreamT |

Fields

- unEventStreamT :: SourceT m (Event ByteString)

#### Instances

Instances details

MonadIO m => FromSourceIO EventStreamChunk (EventStreamT m) Source # | Server-sent events
Instance details Defined in Servant.Client.Core.ServerSentEvents Methods fromSourceIO :: SourceIO EventStreamChunk -> IO (EventStreamT m) Source #
Functor m => Monoid (EventStreamT m) Source # |
Instance details Defined in Servant.Client.Core.ServerSentEvents Methods mempty :: EventStreamT m Source # mappend :: EventStreamT m -> EventStreamT m -> EventStreamT m Source # mconcat :: [EventStreamT m] -> EventStreamT m Source #
Functor m => Semigroup (EventStreamT m) Source # |
Instance details Defined in Servant.Client.Core.ServerSentEvents Methods (<>) :: EventStreamT m -> EventStreamT m -> EventStreamT m Source # sconcat :: NonEmpty (EventStreamT m) -> EventStreamT m Source # stimes :: Integral b => b -> EventStreamT m -> EventStreamT m Source #
(Applicative m, Show1 m) => Show (EventStreamT m) Source # |
Instance details Defined in Servant.Client.Core.ServerSentEvents Methods showsPrec :: Int -> EventStreamT m -> ShowS Source # show :: EventStreamT m -> String Source # showList :: [EventStreamT m] -> ShowS Source #

newtype JsonEventStreamT (m :: Type -> Type) a Source #

Server-sent event stream (SSE) for JSON values

Constructors

JsonEventStreamT |

Fields

- unJsonEventStreamT :: SourceT m (Event a)

#### Instances

Instances details

(MonadIO m, FromJSON a) => FromSourceIO EventStreamChunk (JsonEventStreamT m a) Source # | Server-sent JSON event stream
Instance details Defined in Servant.Client.Core.ServerSentEvents Methods fromSourceIO :: SourceIO EventStreamChunk -> IO (JsonEventStreamT m a) Source #
Functor m => Functor (JsonEventStreamT m) Source # |
Instance details Defined in Servant.Client.Core.ServerSentEvents Methods fmap :: (a -> b) -> JsonEventStreamT m a -> JsonEventStreamT m b Source # (<$) :: a -> JsonEventStreamT m b -> JsonEventStreamT m a Source #
Functor m => Monoid (JsonEventStreamT m a) Source # |
Instance details Defined in Servant.Client.Core.ServerSentEvents Methods mempty :: JsonEventStreamT m a Source # mappend :: JsonEventStreamT m a -> JsonEventStreamT m a -> JsonEventStreamT m a Source # mconcat :: [JsonEventStreamT m a] -> JsonEventStreamT m a Source #
Functor m => Semigroup (JsonEventStreamT m a) Source # |
Instance details Defined in Servant.Client.Core.ServerSentEvents Methods (<>) :: JsonEventStreamT m a -> JsonEventStreamT m a -> JsonEventStreamT m a Source # sconcat :: NonEmpty (JsonEventStreamT m a) -> JsonEventStreamT m a Source # stimes :: Integral b => b -> JsonEventStreamT m a -> JsonEventStreamT m a Source #
(Applicative m, Show1 m, Show a) => Show (JsonEventStreamT m a) Source # |
Instance details Defined in Servant.Client.Core.ServerSentEvents Methods showsPrec :: Int -> JsonEventStreamT m a -> ShowS Source # show :: JsonEventStreamT m a -> String Source # showList :: [JsonEventStreamT m a] -> ShowS Source #

newtype EventMessageStreamT (m :: Type -> Type) Source #

Server-sent event stream (SSE)

See https://www.w3.org/TR/2009/WD-eventsource-20090421/ for more details.

Constructors

EventMessageStreamT |

Fields

- unEventMessageStreamT :: SourceT m EventMessage

#### Instances

Instances details

MonadIO m => FromSourceIO EventStreamChunk (EventMessageStreamT m) Source # | Server-sent event messages `EventMessage` gives you more control over the communication with the server than `Event`.
Instance details Defined in Servant.Client.Core.ServerSentEvents Methods fromSourceIO :: SourceIO EventStreamChunk -> IO (EventMessageStreamT m) Source #
Functor m => Monoid (EventMessageStreamT m) Source # |
Instance details Defined in Servant.Client.Core.ServerSentEvents Methods mempty :: EventMessageStreamT m Source # mappend :: EventMessageStreamT m -> EventMessageStreamT m -> EventMessageStreamT m Source # mconcat :: [EventMessageStreamT m] -> EventMessageStreamT m Source #
Functor m => Semigroup (EventMessageStreamT m) Source # |
Instance details Defined in Servant.Client.Core.ServerSentEvents Methods (<>) :: EventMessageStreamT m -> EventMessageStreamT m -> EventMessageStreamT m Source # sconcat :: NonEmpty (EventMessageStreamT m) -> EventMessageStreamT m Source # stimes :: Integral b => b -> EventMessageStreamT m -> EventMessageStreamT m Source #
(Applicative m, Show1 m) => Show (EventMessageStreamT m) Source # |
Instance details Defined in Servant.Client.Core.ServerSentEvents Methods showsPrec :: Int -> EventMessageStreamT m -> ShowS Source # show :: EventMessageStreamT m -> String Source # showList :: [EventMessageStreamT m] -> ShowS Source #