msgpack-rpc-0.8.0: A MessagePack-RPC Implementation

Portabilityportable
Stabilityexperimental
Maintainertanaka.hideyuki@gmail.com
Safe HaskellNone

Network.MessagePackRpc.Server

Contents

Description

This module is server 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.Server

 add :: Int -> Int -> Method Int
 add x y = return $ x + y

 main = serve 1234 [("add", toMethod add)]

Synopsis

RPC method types

type RpcMethod m = [Object] -> m ObjectSource

class MethodType f m | f -> m whereSource

Methods

toMethod :: f -> RpcMethod mSource

Create a RPC method from a Hakell function

Instances

(OBJECT o, MethodType r m) => MethodType (o -> r) m 
(MonadThrow m, MonadBaseControl IO m, OBJECT o) => MethodType (MethodT m o) m 

newtype MethodT m a Source

Constructors

MethodT 

Fields

unMethodT :: m a
 

Start RPC server

serveSource

Arguments

:: forall m . (MonadIO m, MonadThrow m, MonadBaseControl IO m) 
=> Int

Port number

-> [(String, RpcMethod m)]

list of (method name, RPC method)

-> m () 

Start RPC server with a set of RPC methods.