Portability | portable |
---|---|
Stability | experimental |
Maintainer | [email protected] |
Network.MessagePackRpc.Client
Contents
Description
This module is client library of MessagePack-RPC. The specification of MessagePack-RPC is at http://redmine.msgpack.org/projects/msgpack/wiki/RPCProtocolSpec.
A simple example:
import Network.MessagePackRpc.Client add :: RpcMethod (Int -> Int -> IO Int) add = method "add" main = do conn <- connect "127.0.0.1" 1234 print =<< add conn 123 456
- data Connection
- connect :: String -> Int -> IO Connection
- disconnect :: Connection -> IO ()
- data RpcError
- type RpcMethod a = Connection -> a
- call :: RpcType a => Connection -> String -> a
- method :: RpcType a => String -> RpcMethod a
RPC connection
data Connection Source
RPC connection type
Arguments
:: String | Host name |
-> Int | Port number |
-> IO Connection | Connection |
Connect to RPC server
disconnect :: Connection -> IO ()Source
Disconnect a connection
RPC error
RPC error type
Constructors
ServerError Object | Server error |
ResultTypeError String | Result type mismatch |
ProtocolError String | Protocol error |
Call RPC method
type RpcMethod a = Connection -> aSource
Arguments
:: RpcType a | |
=> Connection | Connection |
-> String | Method name |
-> a |
Call an RPC Method