Skip to content

Commit a1df8fe

Browse files
authored
Added php_serialize protocol for rpc-multilex (#6070)
1 parent 3b15074 commit a1df8fe

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/Constant.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ class Constant
1515
{
1616
public const PROTOCOL_DEFAULT = 'multiplex.default';
1717

18+
public const PROTOCOL_PHP_SERIALIZE = 'multiplex.php_serialize';
19+
1820
public const REQUEST_ID = 'request_id';
1921

2022
public const ID = 'id';

src/Listener/RegisterProtocolListener.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
*/
1212
namespace Hyperf\RpcMultiplex\Listener;
1313

14+
use Hyperf\Codec\Packer\PhpSerializerPacker;
1415
use Hyperf\Event\Contract\ListenerInterface;
1516
use Hyperf\Framework\Event\BootApplication;
1617
use Hyperf\Rpc\ProtocolManager;
@@ -45,5 +46,12 @@ public function process(object $event): void
4546
'path-generator' => PathGenerator::class,
4647
'data-formatter' => DataFormatter::class,
4748
]);
49+
50+
$this->protocolManager->register(Constant::PROTOCOL_PHP_SERIALIZE, [
51+
'packer' => PhpSerializerPacker::class,
52+
'transporter' => Transporter::class,
53+
'path-generator' => PathGenerator::class,
54+
'data-formatter' => DataFormatter::class,
55+
]);
4856
}
4957
}

0 commit comments

Comments
 (0)