- 浏览: 2112295 次
- 性别:
- 来自: 北京
文章分类
最新评论
-
sunzeshan:
找了很久,用了这个插件解决问题啦。谢谢
eclipse jetty debug source not found -
xiaosong0112:
您好,请问为什么要这样设置呢,原理是什么?在网上很多转帖都没有 ...
maven的jetty插件提示No Transaction manager found导致启动慢的解决方法 -
eimhee:
tjzx 写道畅搜谷歌:http://dian168.cc/打 ...
Google 镜像站搜集 -
tjzx:
畅搜谷歌:http://dian168.cc/打开的是“最火源 ...
Google 镜像站搜集 -
eimhee:
finallygo 写道你这属于"头痛医头脚痛医脚& ...
解决linux下too many file问题
The specifications should provide the developer with the information needed to implement the protocol.
NOTE: The JSON-RPC 2.0 Specification proposal has been published and open for review and comments.
Overview¶
JSON-RPC is a lightweight remote procedure call protocol. It's designed to be simple!
The general mechanism consists of two peers establishing a data connection. During the lifetime of a connection, peers may invoke methods provided by the other peer. To invoke a remote method, a request is sent. Unless the request is a notification it must be replied to with a response.
1.1 Request (method invocation)¶
A remote method is invoked by sending a request to a remote service. The request is a single object serialized using JSON.
It has three properties:
•method - A String containing the name of the method to be invoked.
•params - An Array of objects to pass as arguments to the method.
•id - The request id. This can be of any type. It is used to match the response with the request that it is replying to.
1.2 Response¶
When the method invocation completes, the service must reply with a response. The response is a single object serialized using JSON.
It has three properties:
•result - The Object that was returned by the invoked method. This must be null in case there was an error invoking the method.
•error - An Error object if there was an error invoking the method. It must be null if there was no error.
•id - This must be the same id as the request it is responding to.
1.3 Notification¶
A notification is a special request which does not have a response. The notification is a single object serialized using JSON.
It has the same properties as the request object with one exception.
•id - Must be null.
2.1 JSON-RPC over stream connections¶
The specifications do not require a certain transport protocol. The use of TCP/IP socket streams is encouraged. The serialized request and response objects are sent to the peers through the byte streams.
Requests and responses may be sent to a peer at any time. The peer must respond to each request unless it is a notification. A response may only be sent in reply to a request.
Closing the connection between peers must raise an exception for all unanswered requests on each peer. Non-valid requests or responses must result in closing the connection.
2.2 JSON-RPC over HTTP¶
With some limitation, HTTP requests can be used as a transport for communicating between peers.
A communication between peers, one being an HTTP client the other an HTTP server, may span multiple HTTP requests. A client side peer may send one or more requests, notifications or responses to its peer by sending an HTTP POST request containing all serialized objects.
The server side peer must reply with responses to all requests sent and may send requests or notifications of its own. The client side peer must reply to requests received by sending another HTTP POST.
To give the serverside peer a chance to send messages to the client side peer, the client side peer may reopen communication by sending an empty HTTP POST.
A non-valid request must result in closing the connection. A non-valid response must raise an exception for all unanswered requests on the client. Closing a connection must raise an exception for all unanswered requests on the client.
FIXME: Describe/define how sessions are handled, as there is no implicit session formed by a TCP-connection.
3. JSON Class hinting¶
There are only simple data types defined in JSON. To overcome this problem in a JSON compatible way a special property for objects is introduced.
{"__jsonclass__":["constructor", [param1,...]], "prop1": ...}
The object is then instantiated using the constructor, passing in the parameters. Once constructed the properties (prop1, ...) will be applied.
4. Communication Examples¶
--> data sent to service
<-- data coming from service
•service.echo("Hello JSON-RPC")
--> { "method": "echo", "params": ["Hello JSON-RPC"], "id": 1}
<-- { "result": "Hello JSON-RPC", "error": null, "id": 1}
•multiple request responses
This example shows parts of a communication from an example chat application. The chat service sends notifications for each chat message the client peer should receive. The client peer sends requests to post messages to the chat and expects a positive reply to know the message has been posted.
...
--> {"method": "postMessage", "params": ["Hello all!"], "id": 99}
<-- {"result": 1, "error": null, "id": 99}
<-- {"method": "handleMessage", "params": ["user1", "we were just talking"], "id": null}
<-- {"method": "handleMessage", "params": ["user3", "sorry, gotta go now, ttyl"], "id": null}
--> {"method": "postMessage", "params": ["I have a question:"], "id": 101}
<-- {"method": "userLeft", "params": ["user3"], "id": null}
<-- {"result": 1, "error": null, "id": 101}
...
NOTE: The JSON-RPC 2.0 Specification proposal has been published and open for review and comments.
Overview¶
JSON-RPC is a lightweight remote procedure call protocol. It's designed to be simple!
The general mechanism consists of two peers establishing a data connection. During the lifetime of a connection, peers may invoke methods provided by the other peer. To invoke a remote method, a request is sent. Unless the request is a notification it must be replied to with a response.
1.1 Request (method invocation)¶
A remote method is invoked by sending a request to a remote service. The request is a single object serialized using JSON.
It has three properties:
•method - A String containing the name of the method to be invoked.
•params - An Array of objects to pass as arguments to the method.
•id - The request id. This can be of any type. It is used to match the response with the request that it is replying to.
1.2 Response¶
When the method invocation completes, the service must reply with a response. The response is a single object serialized using JSON.
It has three properties:
•result - The Object that was returned by the invoked method. This must be null in case there was an error invoking the method.
•error - An Error object if there was an error invoking the method. It must be null if there was no error.
•id - This must be the same id as the request it is responding to.
1.3 Notification¶
A notification is a special request which does not have a response. The notification is a single object serialized using JSON.
It has the same properties as the request object with one exception.
•id - Must be null.
2.1 JSON-RPC over stream connections¶
The specifications do not require a certain transport protocol. The use of TCP/IP socket streams is encouraged. The serialized request and response objects are sent to the peers through the byte streams.
Requests and responses may be sent to a peer at any time. The peer must respond to each request unless it is a notification. A response may only be sent in reply to a request.
Closing the connection between peers must raise an exception for all unanswered requests on each peer. Non-valid requests or responses must result in closing the connection.
2.2 JSON-RPC over HTTP¶
With some limitation, HTTP requests can be used as a transport for communicating between peers.
A communication between peers, one being an HTTP client the other an HTTP server, may span multiple HTTP requests. A client side peer may send one or more requests, notifications or responses to its peer by sending an HTTP POST request containing all serialized objects.
The server side peer must reply with responses to all requests sent and may send requests or notifications of its own. The client side peer must reply to requests received by sending another HTTP POST.
To give the serverside peer a chance to send messages to the client side peer, the client side peer may reopen communication by sending an empty HTTP POST.
A non-valid request must result in closing the connection. A non-valid response must raise an exception for all unanswered requests on the client. Closing a connection must raise an exception for all unanswered requests on the client.
FIXME: Describe/define how sessions are handled, as there is no implicit session formed by a TCP-connection.
3. JSON Class hinting¶
There are only simple data types defined in JSON. To overcome this problem in a JSON compatible way a special property for objects is introduced.
{"__jsonclass__":["constructor", [param1,...]], "prop1": ...}
The object is then instantiated using the constructor, passing in the parameters. Once constructed the properties (prop1, ...) will be applied.
4. Communication Examples¶
--> data sent to service
<-- data coming from service
•service.echo("Hello JSON-RPC")
--> { "method": "echo", "params": ["Hello JSON-RPC"], "id": 1}
<-- { "result": "Hello JSON-RPC", "error": null, "id": 1}
•multiple request responses
This example shows parts of a communication from an example chat application. The chat service sends notifications for each chat message the client peer should receive. The client peer sends requests to post messages to the chat and expects a positive reply to know the message has been posted.
...
--> {"method": "postMessage", "params": ["Hello all!"], "id": 99}
<-- {"result": 1, "error": null, "id": 99}
<-- {"method": "handleMessage", "params": ["user1", "we were just talking"], "id": null}
<-- {"method": "handleMessage", "params": ["user3", "sorry, gotta go now, ttyl"], "id": null}
--> {"method": "postMessage", "params": ["I have a question:"], "id": 101}
<-- {"method": "userLeft", "params": ["user3"], "id": null}
<-- {"result": 1, "error": null, "id": 101}
...
发表评论
-
jquery dual list 插件
2010-12-21 17:24 2353In my work, I came across the n ... -
ajax upload
2010-11-19 13:22 0ajax upload The following cri ... -
兼容IE和FF获取Referer的JS方法
2010-11-11 10:11 4461众所周知,我们web开发人员痛恨IE浏览器,因为IE不支持标准 ... -
jQuery优化
2010-09-16 08:30 5480之前,我们减少字节数和请求次数以及加载顺序以使页面加载的更快。 ... -
jQuery add table row
2010-08-23 13:39 0The approach you suggest is not ... -
Add and Remove items with jQuery
2010-08-23 13:25 0Add and Remove items with jQuer ... -
extjs和struts、json的整合
2009-08-13 09:52 4497使用extjs配合struts的MVC架构是目前流行的做法,两 ... -
extra 1px space in dialog handle style - Ext JS
2009-04-20 23:33 1560Im developing a new style and h ... -
Grid - Custom header renderer? - Ext JS
2009-04-20 23:33 2051Is it possible to create a cust ... -
Inputs to DatePicker - Ext JS
2009-04-20 23:33 2147I thought I had read that you c ... -
dateFormat with timezone - Ext JS
2009-04-20 23:33 3574If I create JSON data on server ... -
How to use Ext.each? - Ext JS
2009-04-20 23:33 4463I'm trying to use Ext.each. It ... -
afteredit event ... new value? - Ext JS
2009-04-20 23:33 1498the new value is not set before ... -
problem qith iframe's - Ext JS
2009-04-20 23:33 1121I want to have dialogs and wher ... -
[Grid] Ext.data documenation - Ext JS
2009-04-20 23:33 1453I'm porting my grids to use the ... -
Last column to auto-adjust - Ext JS
2009-04-20 23:33 2687I can't see that this is curren ... -
Tree non-async creation "bug" - Ext JS
2009-04-20 23:32 2380When building a tree without us ... -
Bug - reload method of AsyncTreeNode - Ext JS
2009-04-20 23:32 1994Happens when the tree config o ... -
Minor grid paging toolbar issues - Ext JS
2009-04-20 23:32 1503When a grid toolbar is displaye ... -
Grid context menu - Ext JS
2009-04-20 23:32 2061I've made a grid with a context ...
相关推荐
Windows 7的开始按钮非常漂亮,但看久了也会“审美疲劳”,这个名为Windows 7 Start Button Changer的小工具,就是用来替换开始按钮样式的。据说是一个12岁的小网民开发的。 用法非常简单,选择要替换的源文件,再...
通过批处理调用curl来进行changeip的ddns更新,解压到本地某路径,简单修改一下帐户和域名信息,点击start.bat直接运行即可。 参数说明: set user=用户名 set password=密码 set domain=你的ddns set url=...
electron-quick-start-master 快速入门教程electron-quick-start-master 快速入门教程electron-quick-start-master 快速入门教程electron-quick-start-master 快速入门教程electron-quick-start-master 快速入门教程...
Start Menu does not open or not working in Windows 10 Win10开始菜单修复工具Windows 10 Start Menu TroubleShooter下载 这个微软官方Win10开始菜单修复工具是一个单文件的大小只有398KB的小工具,文件名为start...
linux系统命令start-stop-daemon的源码及二进制,其中也提供了一个服务启动脚本模板。 此程序能帮助你实现将命令行程序变成服务运行,比如将"java -jar xxx.jar" 放在后台执行。 ./start-stop-daemon --help start-...
oracle数据库startwith用法
打印机驱动 实达Start BP-750KII 驱动打印机驱动 实达Start BP-750KII 驱动打印机驱动 实达Start BP-750KII 驱动打印机驱动 实达Start BP-750KII 驱动打印机驱动 实达Start BP-750KII 驱动打印机驱动 实达Start BP-...
startServer.sh
打印机驱动 START_PLQ6_OKI5_Drvsky打印机驱动 START_PLQ6_OKI5_Drvsky打印机驱动 START_PLQ6_OKI5_Drvsky打印机驱动 START_PLQ6_OKI5_Drvsky打印机驱动 START_PLQ6_OKI5_Drvsky打印机驱动 START_PLQ6_OKI5_Drvsky...
starTFTP.EXE 最易用的tftp软件
42 Reasons To Start a Business Analyst Career
linux服务器,springboot,spring cloud、spring ...sh start.sh start sh start.sh stop sh start.sh restart sh start.sh status 或者: ./start.sh start ./start.sh stop ./start.sh restart ./start.sh status
1.安装Start8-setup.exe。 1.禁用Stardock Start8服务,重启电脑。 2.根据不同系统查看Start8Shell32.dll或Start8Shell64.dll是否被占用,解除占用或是进入安全模式进行破解。 (破解时这个DLL一定不能被占用,否则...
该工具是用于修复win10菜单栏,鼠标点击无反应的情况。 Windows 10 Start menu troubleshooter
亲测解决tomcat9.08搭配jkd9,搭建servlet环境。常见问题是,The required Server component failed to start so Tomcat is unable to start。这个问题,直接通过配置eclipse来解决这个问题。
很不错的底层程序详解。参考了别人的一些资料。 对于初学者学习start很有帮助!
打印机驱动 实达Start BP-690KPro 票据打印机驱动打印机驱动 实达Start BP-690KPro 票据打印机驱动打印机驱动 实达Start BP-690KPro 票据打印机驱动打印机驱动 实达Start BP-690KPro 票据打印机驱动打印机驱动 实达...
startuml使用手册startuml使用手册startuml使用手册startuml使用手册startuml使用手册startuml使用手册startuml使用手册startuml使用手册startuml使用手册startuml使用手册
打印机驱动 START_BP-690K打印机驱动 START_BP-690K打印机驱动 START_BP-690K打印机驱动 START_BP-690K打印机驱动 START_BP-690K打印机驱动 START_BP-690K打印机驱动 START_BP-690K打印机驱动 START_BP-690K打印机...
startUML建模工具 startUML建模工具startUML建模工具startUML建模工具startUML建模工具