Network.WebSockets.Connection.PingPong

websockets-0.13.0.0: A sensible and clean way to write WebSocket-capable servers in Haskell.

Safe Haskell | None
Language | Haskell2010

Network.WebSockets.Connection.PingPong

Synopsis

- withPingPong :: PingPongOptions -> Connection -> (Connection -> IO ()) -> IO ()
- data PingPongOptions = PingPongOptions {
  - pingInterval :: Int
  - pongTimeout :: Int
  - pingAction :: IO ()
  }
- data PongTimeout = PongTimeout
- defaultPingPongOptions :: PingPongOptions

# Documentation

withPingPong :: PingPongOptions -> Connection -> (Connection -> IO ()) -> IO () #

Run an application with ping-pong enabled. Raises PongTimeout if a pong is not received.

Can used with Client and Server connections.

data PingPongOptions #

Options for ping-pong

Make sure that the ping interval is less than the pong timeout, for example N/2.

Constructors

PingPongOptions |
Fields pingInterval :: Int Interval in seconds pongTimeout :: Int Timeout in seconds pingAction :: IO () Action to perform after sending a ping

data PongTimeout #

Exception type used to kill connections if there is a pong timeout.

Constructors

PongTimeout |

#### Instances

Instances details

Exception PongTimeout # |
Instance details Defined in Network.WebSockets.Connection.PingPong Methods toException :: PongTimeout -> SomeException # fromException :: SomeException -> Maybe PongTimeout # displayException :: PongTimeout -> String # backtraceDesired :: PongTimeout -> Bool #
Show PongTimeout # |
Instance details Defined in Network.WebSockets.Connection.PingPong Methods showsPrec :: Int -> PongTimeout -> ShowS # show :: PongTimeout -> String # showList :: [PongTimeout] -> ShowS #

defaultPingPongOptions :: PingPongOptions #

Default options for ping-pong

Ping every 15 seconds, timeout after 30 seconds