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.
#newEventSource Source
newEventSource :: URL -> Maybe EventSourceConfig -> Effect EventSource
#addEventListener Source
addEventListener :: EventType -> (Event -> Effect Unit) -> Boolean -> EventSource -> Effect Unit
Inherited from EventTarget. EventType corresponds to the
#removeEventListener Source
removeEventListener :: EventType -> (Event -> Effect Unit) -> Boolean -> EventSource -> Effect Unit
Inherited from EventTarget. EventType corresponds to the
#dispatchEvent Source
dispatchEvent :: Event -> EventSource -> Effect Boolean
Inherited from EventTarget. EventType corresponds to the
#setOnError Source
setOnError :: EventSource -> (Event -> Effect Unit) -> Effect Unit
Destructively overwrites the onerror callback for the EventSource
#setOnMessage Source
setOnMessage :: EventSource -> (Event -> Effect Unit) -> Effect Unit
Destructively overwrites the onmessage callback for the EventSource
#readyState Source
readyState :: EventSource -> Effect ReadyState
The 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 -> Boolean
Indicate whether the EventSource object was instantiated with CORS credentials set.
#url Source
url :: EventSource -> URL
#EventSourceConfig Source
type EventSourceConfig = { withCredentials :: Boolean }
Indicate if CORS should be set to include credentials. Default: false
#EventSource Source
newtype EventSource
EventSource class. Inherits from EventTarget
It connects to a server over HTTP and receives events in
text/event-stream
format without closing the connection.
#ReadyState Source
- Modules
- Network.
EventSource