1. 首页
  2. 主题
  3. Go语言

关于jsonrpc的思考以及疑问

xzknet · · 1082 次点击
- 1、go自己搞出来一个gob,做rpc(·net/rpc·),我感觉就是只能go语言自己rpc - 2、go为啥又要搞一个·net/prc/jsonrpc·?能跨语言么? 我也知道json是一个协议,要是·net/prc/jsonrpc·不能解决跨语言问题,那直接·net/prc·多省事啊?为什么还要整一个·jsonrpc·出来呢?有什么优点么?
当然可以啊 只要看下标准和代码就知道json-rpc是什么了 jsonrpc就是指定了以特殊的json格式来发送和接受rpc请求 其中https://www.jsonrpc.org/specification_v1 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. 就是通过post方式发送这个请求,就是一个典型的json api接口 https://github.com/search?q=jsonrpc&type= github上jsonrpc的各语言实现一搜一大堆。
#4
更多评论
https://www.jsonrpc.org/specification 搜一下就知道,jsonrpc是个公开的标准。
#1
net/jsonrpc的第一句就是 Package jsonrpc implements a JSON-RPC 1.0 ClientCodec and ServerCodec for the rpc package 实现的是1.0协议
#2

用户登录

没有账号?注册

今日阅读排行

    加载中

一周阅读排行

    加载中