Network.EventSource
- Package
- purescript-server-sent-events
- Repository
- MichaelXavier/purescript-server-sent-events
An interface to the Server-Sent Events API (SSE).
Not all browsers support this API. See Browser Compatibility.
#EventSource Source
newtype EventSourceEventSource class. Inherits from EventTargetk
It connects to a server over HTTP and receives events in
text/event-stream format without closing the connection.
#EventSourceConfig Source
type EventSourceConfig = { withCredentials :: Boolean }Indicate if CORS should be set to include credentials. Default: false
#ReadyState Source
#readyState Source
readyState :: EventSource -> ReadyStateThe state of the EventSource connection.
CONNECTING The connection has not yet been established, or it was closed and the user agent is reconnecting.
OPEN The user agent has an open connection and is dispatching as it receives them.
CLOSED The connection is not open, and the user agent is not trying to reconnect. Either there was a fatal error or the close() method was invoked.
#withCredentials Source
withCredentials :: EventSource -> BooleanIndicate whether the EventSource object was instantiated with CORS credentials set.
#url Source
url :: EventSource -> URL#newEventSource Source
newEventSource :: forall eff. URL -> Maybe EventSourceConfig -> Eff (dom :: DOM | eff) EventSource#setOnError Source
setOnError :: forall eff. EventSource -> (Event -> Eff (dom :: DOM | eff) Unit) -> Eff (dom :: DOM | eff) UnitDestructively overwrites the onerror callback for the EventSource
#setOnMessage Source
setOnMessage :: forall eff. EventSource -> (Event -> Eff (dom :: DOM | eff) Unit) -> Eff (dom :: DOM | eff) UnitDestructively overwrites the onmessage callback for the EventSource
#dispatchEvent Source
dispatchEvent :: forall eff. Event -> EventSource -> Eff (dom :: DOM, err :: EXCEPTION | eff) BooleanInherited from EventTarget. EventType corresponds to the
- Modules
- Network.
EventSource