The yaml-rpc package

[Tags: bsd3, library]

This library aimed to organize remote procedure call (RPC) over HTTP protocol, using YAML as data serialization format.


[Skip to ReadMe]

Properties

Versions0.1, 0.2, 0.3, 0.3.1, 1.0, 1.0.1, 1.0.2, 1.0.3
Change logNone available
Dependenciesaeson (>=0.7.0.3), base (>=3 && <=5), bytestring (>=0.10.0.2), containers, http-client (>=0.3.3.1), http-types (>=0.8.5), lens (>=4.1), template-haskell, text (>=1.1.1.3), th-lift, transformers (>=0.3.0.0), unordered-containers (>=0.2.4.0), vector (>=0.10.11.0), wreq, yaml [details]
LicenseBSD3
AuthorIlya V. Portnov
Maintainerportnov84@rambler.ru
CategoryNetwork
Home pagehttp://redmine.iportnov.ru/projects/yaml-rpc
Source repositoryhead: git clone git@github.com:portnov/yaml-rpc.git
UploadedThu Jul 3 14:07:16 UTC 2014 by IlyaPortnov
DistributionsNixOS:1.0.3
Downloads915 total (68 in last 30 days)
Votes
0 []
StatusDocs available [build log]
Successful builds reported [all 1 reports]

Modules

[Index]

Downloads

Maintainers' corner

For package maintainers and hackage trustees

Readme for yaml-rpc-1.0.3

YAML-RPC README

Ilya V. Portnov portnov84@rambler.ru

The yaml-rpc package contains a small library to organize remote procedure call (RPC) over TCP/IP network, using JSON as data serialization format.

RPC server should supply a set of "RPC methods", which are simply functions :: a -> b -> ... -> IO c. Arguments must be of class ToJSON (defined in aeson package); result must be of class FromJSON (defined in aeson package too). One can of cause use GHC Generics mechanism to derive needed instances. yaml-rpc package provides a (TemplateHaskell) function Network.YAML.TH.Server.makeAPI to generate API description for server. Such API can be automatically written to file in simple YAML format by using function Network.YAML.TH.Server.writeAPI. It is possible to write different servers, which will use generated API description and provide HTTP REST JSON services with that API. Currently there is only one implementation using scotty package; it is provided by yaml-rpc-scotty package. Please see yaml-rpc-scotty/Test/{Server.hs, TestAPIImpl.hs} files for example usage.

RPC client calls that functions via HTTP REST JSON interface. So, it can be used either from Haskell or from any other environment. For example, it can be easily used from JavaScript with JQuery or another framework. For Haskell, yaml-rpc package provides a function Network.YAML.Caller.call to call any method via HTTP REST JSON interface. Moreover, a (TemplateHaskell) function Network.YAML.TH.Client.useAPI function will read API description from file (in YAML format) and generate wrapper methods for calling respective remote methods. Please see Test/Client.hs for example usage.

Currently, only one-connection-per-call mode is supported by Caller module. There are plans to implement persistent connection support.

API description files can contain not only methods description, but also data types description. Types description can be also automagically generated from usual Haskell definitions and written to API description file. Then, when reading that API description file, usual Haskell data type definitions are generated.

Please see test.api file for example of API description format.

On the server side, usual workflow is as following:

On the client side, usual workflow is as following:

Depends: ghc >= 7.6, yaml, template-haskell, th-lift, wreq, lens, scotty.