Module

WebSocket

Package
purescript-websocket-moderate
Repository
athanclark/purescript-websocket-moderate

#Capabilities Source

type Capabilities m send = { close :: m Unit, close' :: { code :: Maybe Int, reason :: Maybe String } -> m Unit, getBufferedAmount :: m Int, send :: send -> m Unit }

#Environment Source

type Environment = { protocol :: String, url :: String }

#WebSocketsApp Source

newtype WebSocketsApp m receive send

Constructors

Instances

#hoistWebSocketsApp Source

hoistWebSocketsApp :: forall r s n m. (forall a. m a -> n a) -> (forall a. n a -> m a) -> WebSocketsApp m r s -> WebSocketsApp n r s

#dimap' Source

dimap' :: forall receive' send' receive send m. Bind m => (receive' -> m receive) -> (send -> send') -> WebSocketsApp m receive send -> WebSocketsApp m receive' send'

#dimapJson Source

dimapJson :: forall receive send m. EncodeJson send => DecodeJson receive => MonadEffect m => WebSocketsApp m receive send -> WebSocketsApp m Json Json

#newWebSocket Source

newWebSocket :: forall receive send. DecodeJson receive => EncodeJson send => String -> Array String -> WebSocketsApp Effect receive send -> Effect Unit

Creates a new websocket, where the send and receive types are encoded and decoded as JSON strings internally.

#newWebSocketString Source

newWebSocketString :: String -> Array String -> WebSocketsApp Effect String String -> Effect Unit

Creates a new websocket, where the send and receive types are monomorphically typed as a String.

#newWebSocketBinary Source

newWebSocketBinary :: forall binaryType receive send. WebSocketBinary receive => WebSocketBinary send => BinaryType receive binaryType => IsSymbol binaryType => String -> Array String -> WebSocketsApp Effect receive send -> Effect Unit

Creates a new websocket, where the send and receive types are expected to be binary-compatible over the websocket (a Blob or ArrayBuffer).

#newWebSocketBoth Source

newWebSocketBoth :: forall binaryType receive send. WebSocketBinary send => WebSocketBinary receive => BinaryType receive binaryType => IsSymbol binaryType => String -> Array String -> WebSocketsApp Effect String String -> WebSocketsApp Effect receive send -> Effect Unit

Creates a new websocket, where binary data is handled by the binary app when available, otherwise handled by the string app by default.

#BinaryType Source

class BinaryType (a :: Type) (binaryType :: Symbol) | a -> binaryType

Instances