Module: EventMachine::JsonRPC
- Defined in:
- lib/em-jsonrpc/version.rb,
lib/em-jsonrpc/constants.rb,
lib/em-jsonrpc/server.rb,
lib/em-jsonrpc/client.rb
Defined Under Namespace
Constant Summary collapse
- VERSION =
"0.1.0"
- CODE_INVALID_JSON =
-32700
- MSG_INVALID_JSON =
"invalid JSON"
- CODE_INVALID_REQUEST =
-32600
- MSG_INVALID_REQ_JSONRPC =
"invalid request: doesn't include \"jsonrpc\": \"2.0\""
- MSG_INVALID_REQ_ID =
"invalid request: wrong id"
- MSG_INVALID_REQ_METHOD =
"invalid request: wrong method"
- MSG_INVALID_REQ_PARAMS =
"invalid request: wrong params"
- CODE_METHOD_NOT_FOUND =
-32601
- MSG_METHOD_NOT_FOUND =
"method not found"
- CODE_INVALID_PARAMS =
-32602
- MSG_INVALID_PARAMS =
"invalid parameter(s)"
- CODE_INTERNAL_ERROR =
-32603
- MSG_INTERNAL_ERROR =
"internal error"
- PARSING_ERROR_RESPONSE =
"{\"jsonrpc\":\"2.0\",\"id\":null,\"error\":{" \ "\"code\":#{CODE_INVALID_JSON}," \ "\"message\":\"#{MSG_INVALID_JSON}\"}}"
- BATCH_NOT_SUPPORTED_RESPONSE =
"{\"jsonrpc\":\"2.0\",\"id\":null,\"error\":{" \ "\"code\":-32099," \ "\"message\":\"batch mode not implemented\"}}"
- KEY_JSONRPC =
"jsonrpc"
- VALUE_VERSION =
"2.0"
- KEY_ID =
"id"
- KEY_METHOD =
"method"
- KEY_PARAMS =
"params"
- KEY_RESULT =
"result"
- KEY_ERROR =
"error"
- KEY_CODE =
"code"
- KEY_MESSAGE =
"message"
Class Method Summary collapse
- .connect_tcp(host, port, handler, request_timeout = nil, parser_options = {}, &block) ⇒ Object
- .start_tcp_server(addr, port, handler, options = nil, &block) ⇒ Object
- .start_unix_domain_server(filename, handler, options = nil, &block) ⇒ Object
Class Method Details
.connect_tcp(host, port, handler, request_timeout = nil, parser_options = {}, &block) ⇒ Object
188 189 190 191 192 |
# File 'lib/em-jsonrpc/client.rb', line 188 def self.connect_tcp(host, port, handler, request_timeout=nil, ={}, &block) raise Error, "EventMachine is not running" unless EM.reactor_running? EM.connect(host, port, handler, host, port, request_timeout, , &block) end |
.start_tcp_server(addr, port, handler, options = nil, &block) ⇒ Object
198 199 200 201 |
# File 'lib/em-jsonrpc/server.rb', line 198 def self.start_tcp_server(addr, port, handler, =nil, &block) raise Error, "EventMachine is not running" unless EM.reactor_running? EM.start_server addr, port, handler, , &block end |
.start_unix_domain_server(filename, handler, options = nil, &block) ⇒ Object
203 204 205 206 |
# File 'lib/em-jsonrpc/server.rb', line 203 def self.start_unix_domain_server(filename, handler, =nil, &block) raise Error, "EventMachine is not running" unless EM.reactor_running? EM.start_unix_domain_server filename, handler, , &block end |