@@ -111,13 +111,14 @@ data ConnectionState a = ConnectionState {
111111 connectionSocket :: Locking Socket
112112 }
113113
114−-- | Used by server-side request handlers to send additional messages to the client. This is useful for sending asynchronous responses to the client outside of the normal request-response flow.
115−sendMessage :: Serialise a => ConnectionState s -> a -> IO ()
116−sendMessage sState msg = do
114+-- | Used by server-side request handlers to send additional messages to the client. This is useful for sending asynchronous responses to the client outside of the normal request-response flow. The locking socket can be found in the ConnectionState when a request handler is called.
115+sendMessage :: Serialise a => Locking Socket -> a -> IO ()
116+sendMessage lockSock msg = do
117117 requestID <- UUID <$> UUIDBase.nextRandom
118118 let env =
119− Envelope (fingerprint msg) (RequestMessage 0) requestID (serialise msg)
120− sendEnvelope env (connectionSocket sState)
119+ Envelope (fingerprint msg) (RequestMessage timeout) requestID (serialise msg)
120+ timeout = 0
121+ sendEnvelope env lockSock
121122
122123--avoid orphan instance
123124newtype UUID = UUID { _unUUID :: UUIDBase.UUID }