Module
WebSocket.Ws
- Package
- purescript-ws
- Repository
- FruitieX/purescript-ws
#WebSocketServer Source
data WebSocketServer :: Type
The type of a WebSocket server object
#WebSocketConnection Source
data WebSocketConnection :: Type
#WebSocketMessage Source
#WebSocketServerOptions Source
type WebSocketServerOptions = (backlog :: Int, host :: String)
#createWebSocketServer_ Source
createWebSocketServer_ :: forall options e. EffFn2 (ws :: WS | e) options (EffFn1 (ws :: WS | e) Unit Unit) WebSocketServer
#createWebSocketServerWithPort Source
createWebSocketServerWithPort :: forall trash options' options e. Union options options' WebSocketServerOptions => RowLacks "port" options => RowCons "port" Port options trash => Port -> Record options -> (Unit -> Eff (ws :: WS | e) Unit) -> Eff (ws :: WS | e) WebSocketServer
Creates a WebSocket.Server and internally a HTTP server which binds to a given port
The supplied callback is called when the created HTTP server starts listening.
#createWebSocketServerWithServer Source
createWebSocketServerWithServer :: forall trash options' options e. Union options options' WebSocketServerOptions => RowLacks "server" options => RowCons "server" Server options trash => Server -> Record options -> Eff (ws :: WS | e) WebSocketServer
Creates a WebSocket.Server from a pre-existing Node.Server
#onConnection_ Source
onConnection_ :: forall e. EffFn2 (ws :: WS | e) WebSocketServer (EffFn2 (ws :: WS | e) WebSocketConnection Request Unit) Unit
#onConnection Source
onConnection :: forall e. WebSocketServer -> (WebSocketConnection -> Request -> Eff (ws :: WS | e) Unit) -> Eff (ws :: WS | e) Unit
Attaches a connection event handler to a WebSocketServer
#onServerError_ Source
onServerError_ :: forall e. EffFn2 (ws :: WS | e) WebSocketServer (EffFn1 (ws :: WS | e) Error Unit) Unit
#onServerError Source
onServerError :: forall e. WebSocketServer -> (Error -> Eff (ws :: WS | e) Unit) -> Eff (ws :: WS | e) Unit
Attaches an error event handler to a WebSocketServer
#onMessage_ Source
onMessage_ :: forall e. EffFn2 (ws :: WS | e) WebSocketConnection (EffFn1 (ws :: WS | e) WebSocketMessage Unit) Unit
#onMessage Source
onMessage :: forall e. WebSocketConnection -> (WebSocketMessage -> Eff (ws :: WS | e) Unit) -> Eff (ws :: WS | e) Unit
Attaches a message event handler to a WebSocketConnection
#onClose_ Source
onClose_ :: forall e. EffFn2 (ws :: WS | e) WebSocketConnection (EffFn2 (ws :: WS | e) CloseCode CloseReason Unit) Unit
#onClose Source
onClose :: forall e. WebSocketConnection -> (CloseCode -> CloseReason -> Eff (ws :: WS | e) Unit) -> Eff (ws :: WS | e) Unit
Attaches a close event handler to a WebSocketConnection
#sendMessage_ Source
sendMessage_ :: forall e. EffFn2 (ws :: WS | e) WebSocketConnection WebSocketMessage Unit
#sendMessage Source
sendMessage :: forall e. WebSocketConnection -> WebSocketMessage -> Eff (ws :: WS | e) Unit
Send a message over a WebSocketConnection
#close_ Source
close_ :: forall e. EffFn3 (ws :: WS | e) WebSocketConnection CloseCode CloseReason Unit
#close Source
close :: forall e. WebSocketConnection -> Eff (ws :: WS | e) Unit
Initiate a closing handshake
#close' Source
close' :: forall e. WebSocketConnection -> CloseCode -> CloseReason -> Eff (ws :: WS | e) Unit
Initiate a closing handshake with given code and reason
- Modules
- WebSocket.
Ws