This module contains everything that you need to support server-sent events in Yesod applications.
- data RepEventSource
- repEventSource :: (EventSourcePolyfill -> Source (ResourceT IO) ServerEvent) -> GHandler sub master RepEventSource
- ioToRepEventSource :: s -> (EventSourcePolyfill -> s -> IO ([ServerEvent], s)) -> GHandler sub master RepEventSource
- data EventSourcePolyfill
Return a Server-Sent Event stream given an
IO action that
is repeatedly called. An state is threaded for the action so
that it may avoid using
IO action may sleep
or block while waiting for more data. The HTTP socket is
flushed after every list of simultaneous events. The
connection is closed as soon as an
outputted, after which no other events are sent to the client.
EventSource polyfill was detected (if any).
We didn't detect any
See https://github.com/remy/polyfills/blob/master/EventSource.js. In order to support Remy's polyfill, your server needs to explicitly close the connection from time to time--browsers such as IE7 will not show any event until the connection is closed.