msgpack-rpc-0.3.1: A MessagePack-RPC Implementation

Portabilityportable
Stabilityexperimental
Maintainertanaka.hideyuki@gmail.com

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 -> IO Int
add x y = return $ x + y

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

Synopsis

RPC method types

class RpcMethodType f whereSource

Instances

OBJECT o => RpcMethodType (IO o) 
(OBJECT o, RpcMethodType r) => RpcMethodType (o -> r) 

Create RPC method

fun :: RpcMethodType f => f -> RpcMethodSource

Create a RPC method from a Haskell function.

Start RPC server

serveSource

Arguments

:: Int

Port number

-> [(String, RpcMethod)]

list of (method name, RPC method)

-> IO () 

Start RPC server with a set of RPC methods.