msgpack-rpc-1.0.0: A MessagePack-RPC Implementation

Copyright(c) Hideyuki Tanaka, 2010-2015
LicenseBSD3
Maintainertanaka.hideyuki@gmail.com
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Network.MessagePack.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 -> Server Int
add x y = return $ x + y

main = serve 1234 [ method "add" add ]

Synopsis

RPC method types

data Method m Source

MessagePack RPC method

class Monad m => MethodType m f where Source

Methods

toBody :: f -> [Object] -> m Object Source

Create a RPC method from a Hakell function

Instances

Build a method

method Source

Arguments

:: MethodType m f 
=> String

Method name

-> f

Method body

-> Method m 

Build a method

Start RPC server

serve Source

Arguments

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

Port number

-> [Method m]

list of methods

-> m () 

Start RPC server with a set of RPC methods.