Changeset 532
- Timestamp:
- 10/19/07 15:45:55 (6 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
lang/perl/POE-Component-Server-JSONRPC/trunk/lib/POE/Component/Server/JSONRPC.pm
r276 r532 8 8 use POE qw/ 9 9 Component::Server::TCP 10 Filter::Stackable11 Filter::JSON12 10 Filter::Line 13 11 /; … … 16 14 =head1 NAME 17 15 18 POE::Component::Server::JSONRPC - Module abstract (<= 44 characters) goes here16 POE::Component::Server::JSONRPC - POE tcp based JSON-RPC server 19 17 20 18 =head1 SYNOPSIS … … 42 40 =head1 DESCRIPTION 43 41 44 Stub documentation for this module was created by ExtUtils::ModuleMaker. 45 It looks like the author of the extension was negligent enough 46 to leave the stub unedited. 47 48 Blah blah blah. 42 This module is a POE component for tcp based JSON-RPC Server. 43 44 The specification is defined on http://json-rpc.org/ and this module use JSON-RPC 1.0 spec (1.1 does not cover tcp streams) 49 45 50 46 =head1 METHODS 51 47 52 48 =head2 new 49 50 Create JSONRPC component session and return the session id. 51 52 Parameters: 53 54 =over 55 56 =item Port 57 58 Port number for listen. 59 60 =item Handler 61 62 Hash variable contains handler name as key, handler poe state name as value. 63 64 Handler name (key) is used as JSON-RPC method name. 65 66 So if you send {"method":"echo"}, this module call the poe state named "echo". 67 68 =back 53 69 54 70 =cut … … 72 88 } 73 89 90 =head1 HANDLER PARAMETERS 91 92 =over 93 94 =item ARG0 95 96 A session id of PoCo::Server::JSONRPC itself. 97 98 =item ARG1 .. ARGN 99 100 JSONRPC argguments 101 102 =back 103 104 ex) If you send following request 105 106 {"method":"echo", "params":["foo", "bar"]} 107 108 then, "echo" handler is called and parameters is that ARG0 is component session id, ARG1 "foo", ARG2 "bar". 109 110 =head1 HANDLER RESPONSE 111 112 You must call either "result" or "error" state in your handlers to response result or error. 113 114 ex: 115 116 $kernel->post( $component_session_id => "result" => "result value" ) 117 118 $component_session_id is ARG0 in handler. If you do above, response is: 119 120 {"result":"result value", "error":""} 121 122 74 123 =head1 POE METHODS 124 125 Inner method for POE states. 75 126 76 127 =head2 poe__start
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)