sofastack / sofa-rpc-node

SOFARPC Node is a high-performance, high-extensibility, production-level Nodejs RPC framework.
MIT License
612 stars 64 forks source link

sofa node作为客户端,调用使用hessian4的版本的服务端,出现异常 #57

Closed ghost closed 4 years ago

ghost commented 5 years ago

Describe the bug A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context Add any other context about the problem here.

服务端使用默认hessian3序列化版本,用node客户端去调用服务端,服务端可以正常接收请求,并返回, 但是当服务端hessian版本换成4的话,使用原来的node代码去调用的时候,出现异常,服务端未收到请求,我猜是序列化的问题,以下是错误日志: image,寻求专业解答。

gxcsoccer commented 5 years ago

目前 node 客户端不支持 hessian4,后面会支持的

trexguo commented 4 years ago

计划什么时候支持呢?

gxcsoccer commented 4 years ago

5月底吧,抽空搞下

gxcsoccer commented 4 years ago

https://github.com/sofastack/sofa-bolt-node/pull/11

这个合并以后支持

const protocol = require('sofa-bolt-node');
protocol.setHessianVersion('4.0');

const { RpcClient } = require('sofa-rpc-node').client;

const client = new RpcClient({
  logger: console,
  protocol,
});
gxcsoccer commented 4 years ago

安装 egg-sofa-rpc@3.0.0

// config.default.js

exports.rpc = {
  hessianVersion: '4.0',
};