Module

WebSocket

Package
purescript-websocket-simple
Repository
zudov/purescript-websocket-simple

This module defines a simple low-level interface to the websockets API.

#WEBSOCKET Source

data WEBSOCKET :: Effect

The effect associated with websocket connections.

#WebSocket Source

data WebSocket :: Type

A reference to a WebSocket object.

#newWebSocket Source

newWebSocket :: forall eff. URL -> Array Protocol -> Eff (err :: EXCEPTION, ws :: WEBSOCKET | eff) Connection

Initiate a websocket connection.

#Connection Source

newtype Connection
  • binaryType -- The type of binary data being transmitted by the connection.
  • bufferedAmount -- The number of bytes of data that have been queued using calls to send but not yet transmitted to the network. This value does not reset to zero when the connection is closed; if you keep calling send, this will continue to climb.
  • onclose -- An event listener to be called when the Connection's readyState changes to Closed.
  • onerror -- An event listener to be called when an error occurs.
  • onmessage -- An event listener to be called when a message is received from the server.
  • onopen -- An event listener to be called when the Connection's readyState changes to Open; this indicates that the connection is ready to send and receive data.
  • protocol -- A string indicating the name of the sub-protocol the server selected.
  • readyState -- The current state of the connection.
  • url -- The URL as resolved by during construction. This is always an absolute URL.
  • close -- Closes the connection or connection attempt, if any. If the connection is already CLOSED, this method does nothing. If Code isn't specified a default value of 1000 (indicating a normal "transaction complete" closure) is assumed
  • send -- Transmits data to the server.
  • socket -- Reference to closured WebSocket object.

Constructors

#BinaryType Source

data BinaryType

The type of binary data being transmitted by the connection.

Constructors

#BufferedAmount Source

newtype BufferedAmount

The number of bytes of data that have been buffered (queued but not yet transmitted)

Instances

#Protocol Source

newtype Protocol

A string indicating the name of the sub-protocol.

Constructors

Instances

#Code Source

newtype Code

Should be either equal to 1000 (indicating normal closure) or in the range of 3000-4999.

Constructors

Instances

#runCode Source

#Reason Source

newtype Reason

A human-readable string explaining why the connection is closing. This string must be no longer than 123 bytes of UTF-8 text (not characters).

Constructors

Instances

#URL Source

newtype URL

A synonym for URL strings.

Constructors

Instances

#runURL Source

#Message Source

newtype Message

A synonym for message strings.

Constructors

Modules
WebSocket