heartbeat-streams-0.1.0.0: Heartbeats for io-streams

Safe HaskellNone
LanguageHaskell2010

System.IO.Streams.Heartbeat

Synopsis

Documentation

heartbeatOutputStream Source #

Arguments

:: DiffTime

Heartbeat interval

-> a

Heartbeat message

-> OutputStream a 
-> IO (OutputStream a) 

Send a message a if nothing has been written on the stream for some interval of time. Writing Nothing to this OutputStream is required for proper cleanup.

heartbeatInputStream Source #

Arguments

:: DiffTime

Heartbeat interval

-> DiffTime

Grace time multiplier

-> InputStream a 
-> IO (InputStream a) 

Grace period = grace time multiplier x heartbeat interval Usually something like graceMultiplier = 2 is a good idea.

This throws a MissedHeartbeat exception if a heartbeat is not received within the grace period.