hprose / hprose-swoole

Hprose asynchronous client & standalone server based on swoole

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

hprose-ruby客户端data长度超过124,swoole服务端无响应

wqyer opened this issue · comments

客户端:使用hprose-ruby,ruby:2.5.0,rails:5.1.5
服务端:使用hprose/swoole/server, php: 7.1.16, laravel: 5.5

实际使用过程中,客户端调用服务时,参数总体长度超过124时服务端疑似卡在

$self->defaultHandle($data, $context)->then(function($data) use ($self, $server, $socket, $id) { $self->socketSend($server, $socket, $data, $id); });

为了解决这个问题,我在客户端调用时先对参数进行了to_json和Base64两步转化
然后在服务端插件代码中插入一行代码($bytes = utf8_decode($bytes);)以解决这个问题
use ($self, &$bytes, &$headerLength, &$dataLength, &$id) { $bytes .= $data; $bytes = utf8_decode($bytes); while (true) {

但这毕竟不是一个根本的解决办法,看看有没有更好的解决办法

不知道 hprose-ruby 版本是不是你修改过,我看到 hprose-ruby 版本有个 pull request 提交,但那个修改是错误的。如果你用的是那个修改版本的 hprose-ruby,肯定是不能互通的。请不要自己修改 hprose-ruby,使用原版的就可以了。