Skip to content

Commit

Permalink
Added a way to manually send a Pong message (#217)
Browse files Browse the repository at this point in the history
  • Loading branch information
RationalAsh authored Dec 20, 2023
1 parent 7a39574 commit 0da1993
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Network/WebSockets/Connection.hs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ module Network.WebSockets.Connection
, sendClose
, sendCloseCode
, sendPing
, sendPong

, withPingThread
, forkPingThread
Expand Down Expand Up @@ -388,6 +389,10 @@ sendCloseCode conn code =
sendPing :: WebSocketsData a => Connection -> a -> IO ()
sendPing conn = send conn . ControlMessage . Ping . toLazyByteString

--------------------------------------------------------------------------------
-- | Send a pong
sendPong :: WebSocketsData a => Connection -> a -> IO ()
sendPong conn = send conn . ControlMessage . Pong . toLazyByteString

--------------------------------------------------------------------------------
-- | Forks a ping thread, sending a ping message every @n@ seconds over the
Expand Down

0 comments on commit 0da1993

Please sign in to comment.