hprose / hprose-swoole

Hprose asynchronous client & standalone server based on swoole
MIT License
182 stars 41 forks source link

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

Open wqyer opened 6 years ago

wqyer commented 6 years ago

客户端:使用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); });

wqyer commented 6 years ago

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

wqyer commented 6 years ago

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

andot commented 6 years ago

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