Safe Haskell | None |
---|---|
Language | Haskell2010 |
- data WebSocket
Documentation
Endpoint for defining a route to provide a web socket. The
handler function gets an already negotiated websocket Connection
to send and receive data.
Example:
type WebSocketApi = "stream" :> WebSocket server :: Server WebSocketApi server = streamData where streamData :: MonadIO m => Connection -> m () streamData c = liftIO . forM_ [1..] $ \i -> do forkPingThread c 10 sendTextData c (pack $ show (i :: Int)) >> threadDelay 1000000