Go JSON RPC v2通过HTTP进行通信

huangapple go评论76阅读模式
英文:

Go JSON RPC v2 over HTTP

问题

在Go语言世界中,是否有任何项目实现了JSON RPC 2.0(HTTP),特别是批量查询的功能?

一些背景信息是,我知道Go内置了一个,但它不是通过HTTP实现的,而Gorilla看起来支持V2(在v2文件夹中),但我找不到相关的文档。但是,当我测试它时,对于像"[{valid_request...},{valid_request...}]"这样的组合请求,它返回了空结果。也许它还没有实现批量查询功能。(我有没有漏掉什么东西?)

英文:

In the Go world is there any project implements the JSON RPC 2.0 (HTTP), especially the feature of batched query?

Some background that is, I know there's a Go built-in one but it's not over HTTP, and Gorilla looks to supports V2 (in the v2 folder, however I can't find documentation with it), but as I tested it response empty result for a combined request like "[{valid_request...},{valid_request...}]". Maybe it hasn't implemented the batched one. (Have I missed anything to get it right?)

答案1

得分: 1

由于我目前找不到现成的支持JsonRpc 2.0的Go服务器,所以我修改了gorilla JsonRPC 2.0以支持批量查询。分叉的存储库位于https://github.com/jason-xxl/rpc。只需要将导入路径从"gorilla/rpc/v2"更改为"jason-xxl/rpc/v2_batch",就可以获得一个可测试的启用了批量查询的服务器。(如果我错过了已经支持2.0批处理的任何一个,请告诉我。)

英文:

Since I can't find a ready Go server support for JsonRpc 2.0 for now, I modified the gorilla JsonRPC 2.0 to support the batched query. The forked repo is at https://github.com/jason-xxl/rpc . Just need to change the import path from "gorilla/rpc/v2" to "jason-xxl/rpc/v2_batch" to get a testable batched query enabled server. (Please let me know if I missed any one that already support 2.0 batch.)

huangapple
  • 本文由 发表于 2014年9月24日 16:53:11
  • 转载请务必保留本文链接:https://go.coder-hub.com/26012567.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定