Sha256: 7d510ecbd376368352f036ec94e537e5d95bb87d3c4c83bbf4df08e7b1c93c9e
Contents?: true
Size: 1.15 KB
Versions: 26
Compression:
Stored size: 1.15 KB
Contents
.\" generated with Ronn/v0.6.6 .\" http://github.com/rtomayko/ronn/ . .TH "JSONRPC" "" "June 2010" "" "" . .SH "JSON\-RPC" The \fIjsonrpc\fR middleware provides JSON\-RPC 2\.0 support\. Below is an example exposing the \fIadd\fR and \fIsub\fR methods: . .IP "" 4 . .nf var math = { add: function(a, b){ try { this(null, a + b); } catch (err) { this(err); } }, sub: function(a, b){ try { this(null, a \- b); } catch (err) { this(err); } } }; var date = { time: function(){ this(null, new Date()\.toUTCString()); } }; module\.exports = Connect\.createServer( Connect\.jsonrpc(math, date) ); . .fi . .IP "" 0 . .P The value of \fIthis\fR becomes the async callback function\. When you wish to pass an exception simply invoke \fBthis(err)\fR, or pass the error code \fBthis(jsonrpc\.INVALID_PARAMS)\fR\. Other \fBthis(null, result)\fR will respond with the given results\. . .SS "Features" . .IP "\(bu" 4 async support . .IP "\(bu" 4 batch request support . .IP "\(bu" 4 variable argument length . .IP "\(bu" 4 named parameter support . .IP "" 0
Version data entries
26 entries across 26 versions & 1 rubygems