Skip to content

Releases: buexplain/netsvr-protocol-php

v7.0.0

Choose a tag to compare

@buexplain buexplain released this 13 Sep 05:15

netsvr-protocol-php v7.0.0

基于 netsvr-protocol v7.0.1 重新生成的 PHP 协议代码,
对应协议大版本 v7。破坏性更新,需与网关(netsvr v9)、业务侧同步升级。

环境要求

  • PHP >= 8.0
  • 运行时需要 google/protobuf(composer 包)或 protobuf PHP 扩展

安装

composer require buexplain/netsvr-protocol-php

破坏性变更

1. 指令枚举(NetsvrProtocol\Cmd)

变更 枚举常量 枚举号
重命名 Broadcast → BroadcastBulk 900002003(不变)
移除 Multicast 900002004
移除 MulticastByCustomerId 900002005
移除 SingleCast 900002006
移除 SingleCastByCustomerId 900002008
移除 TopicPublish 900002013

2. 字段编号规整(wire 格式不兼容)

对应 netsvr-protocol 的「规整消息字段编号,消除历史删字段留下的号段空洞」:

消息 字段 编号变化
ConnInfoUpdate newSession / newCustomerId / newTopics / data 3→2 / 4→3 / 5→4 / 6→5
MetricsRespItem rate1 / rate5 / rate15 5→4 / 7→5 / 9→6
TopicUniqIdListResp items 2→1

3. 删除的类(共 12 个文件)

Broadcast、Multicast、MulticastByCustomerId、SingleCast、SingleCastByCustomerId、TopicPublish
(NetsvrProtocol 与 GPBMetadata 各一份)

新增

BroadcastBulk、SingleCastBulkItem、SingleCastBulkByCustomerIdItem、TopicPublishBulkItem。

批量协议统一为 item 内「多目标 × 多数据」:每一项是一组目标与其数据,网关按 data 顺序把每条数据
依次发给该项内的每个目标。

use NetsvrProtocol\SingleCastBulk;
use NetsvrProtocol\SingleCastBulkItem;

$req = new SingleCastBulk([
    'items' => [
        new SingleCastBulkItem([
            'uniqIds' => ['u1', 'u2'],
            'data'    => ['a', 'b'],
        ]),
    ],
]);
// u1、u2 都会按 a、b 的顺序各收到两条

注释口径同步

  • 术语统一为「网关」「业务进程」
  • 统计 / 查询类响应写明「单网关部署 / 多网关部署」的聚合与重复统计语义
  • 强制关闭类协议写明关闭时序(先转发 data,再写关闭帧,2 秒后强制关闭连接)
  • 批量协议写明网关处理要求(按 items 顺序、项内按 data 顺序、跳过不存在的目标与空数据等)

完整变更

  • ff95434 按协议 v7.0.1 重新生成 PHP 代码
  • 404ae85 依赖升级:netsvr-protocol ^v6.0.1 → ^7.0

Full Changelog: v6.0.0...v7.0.0

v6.0.0

Choose a tag to compare

@buexplain buexplain released this 13 Mar 12:43
  1. 移除RegisterReq的ProcessCmdGoroutineNum字段
  2. 移除ConnOpen的SubProtocol字段

v5.1.0

Choose a tag to compare

@buexplain buexplain released this 10 Jul 15:20
  1. 新增连接打开的回调接口返回值

v5.0.0

Choose a tag to compare

@buexplain buexplain released this 13 Feb 12:02

变更命名空

v4.0.0

Choose a tag to compare

@buexplain buexplain released this 10 Nov 07:06
  1. 移除服务状态统计的最大值统计
  2. 新增指令TopicCustomerIdToUniqIdsList,获取网关中某几个主题的customerId以及对应的uniqId列表

v3.0.0

Choose a tag to compare

@buexplain buexplain released this 28 Jul 03:59
  1. 移除connOpenCustomUniqIdToken指令
  2. 移除serverId
  3. 新增event.proto,规定网关转发的事件
  4. 新增customerId相关指令

v2.0.1

Choose a tag to compare

@buexplain buexplain released this 06 Dec 13:39

删除router

v2.0.0

Choose a tag to compare

@buexplain buexplain released this 12 Nov 07:25
  1. 删除router
  2. 变更取消注册的逻辑,支持别的连接取消一个已经注册的连接

v1.4.0

Choose a tag to compare

@buexplain buexplain released this 03 Sep 03:38

增强批量单播指令、批量发布主题指令,支持一次性向一个topic、uniqId发送多条数据

v1.3.0

Choose a tag to compare

@buexplain buexplain released this 27 Aug 04:00

新增批量发布主题的指令