Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- type SyncMap = Map UUID (MVar (Either ConnectionError BinaryMessage), UTCTime)
- data Connection = Connection {}
- data ClientAsyncRequestHandler where
- ClientAsyncRequestHandler :: forall a. Serialise a => (a -> IO ()) -> ClientAsyncRequestHandler
- type ClientAsyncRequestHandlers = [ClientAsyncRequestHandler]
- connect :: ClientAsyncRequestHandlers -> HostAddr -> PortNumber -> IO Connection
- close :: Connection -> IO ()
- clientAsync :: Socket -> SyncMap -> ClientAsyncRequestHandlers -> IO ()
- consumeResponse :: UUID -> Map UUID (MVar a, b) -> a -> IO ()
- clientEnvelopeHandler :: ClientAsyncRequestHandlers -> Locking Socket -> SyncMap -> Envelope -> IO ()
- call :: (Serialise request, Serialise response) => Connection -> request -> IO (Either ConnectionError response)
- callTimeout :: (Serialise request, Serialise response) => Maybe Int -> Connection -> request -> IO (Either ConnectionError response)
- asyncCall :: Serialise request => Connection -> request -> IO (Either ConnectionError ())
Documentation
type SyncMap = Map UUID (MVar (Either ConnectionError BinaryMessage), UTCTime) Source #
data Connection Source #
Represents a remote connection to server.
data ClientAsyncRequestHandler where Source #
Function handlers run on the client, triggered by the server- useful for asynchronous callbacks.
ClientAsyncRequestHandler :: forall a. Serialise a => (a -> IO ()) -> ClientAsyncRequestHandler |
connect :: ClientAsyncRequestHandlers -> HostAddr -> PortNumber -> IO Connection Source #
Connects to a remote server with specific async callbacks registered.
close :: Connection -> IO () Source #
Close the connection and release all connection resources.
clientAsync :: Socket -> SyncMap -> ClientAsyncRequestHandlers -> IO () Source #
async thread for handling client-side incoming messages- dispatch to proper waiting thread or asynchronous notifications handler
clientEnvelopeHandler :: ClientAsyncRequestHandlers -> Locking Socket -> SyncMap -> Envelope -> IO () Source #
handles envelope responses from server- timeout from ths server is ignored, but perhaps that's proper for trusted servers- the server expects the client to process all async requests
call :: (Serialise request, Serialise response) => Connection -> request -> IO (Either ConnectionError response) Source #
Basic remote function call via data type and return value.
callTimeout :: (Serialise request, Serialise response) => Maybe Int -> Connection -> request -> IO (Either ConnectionError response) Source #
Send a request to the remote server and returns a response but with the possibility of a timeout after n microseconds.
asyncCall :: Serialise request => Connection -> request -> IO (Either ConnectionError ()) Source #
Call a remote function but do not expect a response from the server.