msgpack-rpc-0.7.0: A MessagePack-RPC Implementation

Portabilityportable
Stabilityexperimental
Maintainertanaka.hideyuki@gmail.com
Safe HaskellSafe-Infered

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

Synopsis

RPC connection

data Connection Source

RPC connection type

connectSource

Arguments

:: String

Host name

-> Int

Port number

-> IO Connection

Connection

Connect to RPC server

disconnect :: Connection -> IO ()Source

Disconnect a connection

RPC error

data RpcError Source

RPC error type

Constructors

ServerError Object

Server error

ResultTypeError String

Result type mismatch

ProtocolError String

Protocol error

Call RPC method

callSource

Arguments

:: RpcType a 
=> Connection

Connection

-> String

Method name

-> a 

Call an RPC Method

method :: RpcType a => String -> RpcMethod aSource

Create an RPC Method (call c m == method m c)