miso
Copyright(C) 2016-2025 David M. Johnson
LicenseBSD3-style (see the file LICENSE)
MaintainerDavid M. Johnson <code@dmj.io>
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Miso.EventSource

Description

Functions and types for working with Server Sent Events

Synopsis

EventSource

connectText Source #

Arguments

:: URL 
-> (EventSource -> action)

onOpen

-> (MisoString -> action)

onMessage

-> (MisoString -> action)

onError

-> Effect parent model action 

connectJSON Source #

Arguments

:: FromJSON value 
=> URL 
-> (EventSource -> action)

onOpen

-> (value -> action)

onMessage

-> (MisoString -> action)

onError

-> Effect parent model action 

socketState :: WebSocket -> (SocketState -> action) -> Effect parent model action Source #

Retrieves current status of WebSocket

If the WebSocket identifier does not exist a CLOSED is returned.

Defaults

emptyEventSource :: EventSource Source #

A null EventSource is one with a negative descriptor.

Types

type URL = MisoString Source #

URL that the WebSocket will connect to

Re-exports

data Payload value Source #

Payload is used as the potential source of data when working with EventSource

Constructors

JSON value

JSON-encoded data

BLOB Blob

Binary encoded data

TEXT MisoString

Text encoded data

BUFFER ArrayBuffer

Buffered data