PHPackages                             buexplain/netsvr-protocol - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. buexplain/netsvr-protocol

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

buexplain/netsvr-protocol
=========================

https://github.com/buexplain/netsvr的协议

v6.0.1(1mo ago)0471Apache-2.0GoPHP &gt;=8.0CI passing

Since Jun 18Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/buexplain/netsvr-protocol)[ Packagist](https://packagist.org/packages/buexplain/netsvr-protocol)[ RSS](/packages/buexplain-netsvr-protocol/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)DependenciesVersions (14)Used By (1)

netsvr-protocol
===============

[](#netsvr-protocol)

这套`proto`是的网关层与业务层的交互协议。

指令有如下三种类别：

1. 网关单向转发给业务进程的指令
2. 业务进程单向请求网关的指令
3. 业务进程请求网关，网关处理完毕再响应给业务进程的指令

### 网关单向转发给业务进程的指令

[](#网关单向转发给业务进程的指令)

名称编号proto说明websocket连接打开[ConnOpen](cmd.proto#L30)[connOpen.proto](connOpen.proto)网关转发客户端连接打开的信息到业务进程websocket连接打开信息回调到业务接口的返回值无[connOpenResp.proto](connOpenResp.proto)网关通过http协议转发客户端连接打开的信息到业务进程http接口，接口返回给网关的数据websocket连接关闭[ConnClose](cmd.proto#L31)[connClose.proto](connClose.proto)网关转发客户端连接关闭的信息到业务进程透传客户端的websocket数据[Transfer](cmd.proto#L32)[transfer.proto](transfer.proto)网关转发客户端连接发来的数据到业务进程### 业务进程单向请求网关的指令

[](#业务进程单向请求网关的指令)

名称编号proto说明更新连接的信息[ConnInfoUpdate](cmd.proto#L36)[connInfoUpdate.proto](connInfoUpdate.proto)每个客户端连接都可以在网关中存储：业务系统唯一id、订阅的主题标签、session信息，该指令用于设置这些信息删除连接的信息[ConnInfoDelete](cmd.proto#L37)[connInfoDelete.proto](connInfoDelete.proto)删除客户连接的：业务系统唯一id、订阅的主题标签、session信息广播[Broadcast](cmd.proto#L38)[broadcast.proto](broadcast.proto)给网关中所有客户端连接都发送一条信息根据uniqId组播[Multicast](cmd.proto#L39)[multicast.proto](multicast.proto)给指定的某几个客户端连接发送一条信息根据customerId组播[MulticastByCustomerId](cmd.proto#L40)[multicastByCustomerId.proto](multicastByCustomerId.proto)给指定的某几个客户端id发送一条信息根据uniqId单播[SingleCast](cmd.proto#L41)[singleCast.proto](singleCast.proto)给指定的某个客户连接发送一条信息根据uniqId批量单播[SingleCastBulk](cmd.proto#L42)[singleCastBulk.proto](singleCastBulk.proto)将多对单播数据打包成一个块，一次性发送给网关根据customerId单播[SingleCastByCustomerId](cmd.proto#L43)[singleCastByCustomerId.proto](singleCastByCustomerId.proto)给指定的某个客户端id发送一条信息根据customerId批量单播[SingleCastBulkByCustomerId](cmd.proto#L44)[singleCastBulkByCustomerId.proto](singleCastBulkByCustomerId.proto)将多对单播数据打包成一个块，一次性发送给网关订阅某几个主题[TopicSubscribe](cmd.proto#L45)[topicSubscribe.proto](topicSubscribe.proto)客户端连接订阅某几个主题的数据，比如客户端加入的群的id，用于接收该群的消息取消订阅某几个主题[TopicUnsubscribe](cmd.proto#L46)[topicUnsubscribe.proto](topicUnsubscribe.proto)客户端连取消订阅某几个主题的数据，比如客户端退群了，可以将之前订阅的群id删除删除某几个主题[TopicDelete](cmd.proto#L47)[topicDelete.proto](topicDelete.proto)删除网关中某几个主题，所有订阅了这些被删除主题的客户端连接都会取消订阅它们给某几个主题发布信息[TopicPublish](cmd.proto#L48)[topicPublish.proto](topicPublish.proto)一份消息发布到多个主题批量发布到某几个主题[TopicPublishBulk](cmd.proto#L49)[topicPublishBulk.proto](topicPublishBulk.proto)多份消息发布到多个主题，或者多份消息发布到一个主题强制关闭某几个连接[ForceOffline](cmd.proto#L50)[forceOffline.proto](forceOffline.proto)根据uniqId，强制关闭某几个客户端连接，比如客户在多个设备连接到网关，则可用此指令去强制关闭客户其它设备的连接强制关闭某几个客户的所有连接[ForceOfflineByCustomerId](cmd.proto#L51)[forceOfflineByCustomerId.proto](forceOfflineByCustomerId.proto)根据customerId强制关闭某个客户连接，一般是剔下线用，该客户在所有设备登录到网关的所有连接都会被关闭强制关闭某几个空session、空customerId的连接[ForceOfflineGuest](cmd.proto#L52)[forceOfflineGuest.proto](forceOfflineGuest.proto)强制关闭某个空session值与空customerId的连接，比如客户端连接到网关，但是并没有发起账号密码登录的请求，此时业务侧又不希望此类连接一直逗留在网关中，则可以用该指令去延迟一分钟后强制关闭它，当然如果一分钟后，客户端登录成功，则不会关闭### 业务进程请求网关，网关处理完毕再响应给业务进程的指令

[](#业务进程请求网关网关处理完毕再响应给业务进程的指令)

名称编号proto说明注册到网关[Register](cmd.proto#L56)[registerReq.proto](registerReq.proto)、[registerResp.proto](registerResp.proto)业务进程向网关的worker服务器发出注册指令，注册成功后，business会收到worker服务器转发的客户端websocket消息撤销注册[Unregister](cmd.proto#L57)[unRegisterReq.proto](unRegisterReq.proto)、[unRegisterResp.proto](unRegisterResp.proto)业务进程向网关的worker服务器发出取消注册指令，取消注册成功后，业务进程不会再收到客户端websocket消息检查uniqId是否在线[CheckOnline](cmd.proto#L58)[checkOnlineReq.proto](checkOnlineReq.proto)、[checkOnlineResp.proto](checkOnlineResp.proto)判断某几个uniqId是否在在线，有则返回uniqId值获取网关中全部的customerId[CustomerIdList](cmd.proto#L59)[customerIdListResp.proto](customerIdListResp.proto)-统计网关中customerId的数量[CustomerIdCount](cmd.proto#L60)[customerIdCountResp.proto](customerIdCountResp.proto)-获取全部连接的uniqId[UniqIdList](cmd.proto#L61)[uniqIdListResp.proto](uniqIdListResp.proto)-统计网关的在线连接数[UniqIdCount](cmd.proto#L62)[uniqIdCountResp.proto](uniqIdCountResp.proto)-获取网关的全部主题[TopicList](cmd.proto#L63)[topicListResp.proto](topicListResp.proto)-统计网关的主题数量[TopicCount](cmd.proto#L64)[topicCountResp.proto](topicCountResp.proto)-获取网关中某几个主题包含的uniqId[TopicUniqIdList](cmd.proto#L65)[topicUniqIdListReq.proto](topicUniqIdListReq.proto)、[topicUniqIdListResp.proto](topicUniqIdListResp.proto)-统计网关中某几个主题包含的uniqId数量[TopicUniqIdCount](cmd.proto#L66)[topicUniqIdCountReq.proto](topicUniqIdCountReq.proto)、[topicUniqIdCountResp.proto](topicUniqIdCountResp.proto)-获取网关中某几个主题的customerId[TopicCustomerIdList](cmd.proto#L67)[topicCustomerIdListReq.proto](topicCustomerIdListReq.proto)、[topicCustomerIdListResp.proto](topicCustomerIdListResp.proto)-获取网关中某几个主题的customerId以及对应的uniqId列表[TopicCustomerIdToUniqIdsList](cmd.proto#L68)[topicCustomerIdToUniqIdsListReq.proto](topicCustomerIdToUniqIdsListReq.proto)、[topicCustomerIdToUniqIdsListResp.proto](topicCustomerIdToUniqIdsListResp.proto)-统计网关某个主题的customerId数量[TopicCustomerIdCount](cmd.proto#L69)[topicCustomerIdCountReq.proto](topicCustomerIdCountReq.proto)、[topicCustomerIdCountResp.proto](topicCustomerIdCountResp.proto)-获取uniqId的连接信息[ConnInfo](cmd.proto#L70)[connInfoReq.proto](connInfoReq.proto)、[connInfoResp.proto](connInfoResp.proto)-获取customerId的连接信息[ConnInfoByCustomerId](cmd.proto#L71)[connInfoByCustomerIdReq.proto](connInfoByCustomerIdReq.proto)、[connInfoByCustomerIdResp.proto](connInfoByCustomerIdResp.proto)-获取网关状态的统计信息[Metrics](cmd.proto#L72)[metricsResp.proto](metricsResp.proto)-设置并返回限流配置[Limit](cmd.proto#L73)[limitReq.proto](limitReq.proto)、[limitResp.proto](limitResp.proto)先更新限流配置，如果传递的值无效，则会忽略它；再返回网关中的最新的限流配置

###  Health Score

44

—

FairBetter than 91% of packages

Maintenance94

Actively maintained with recent releases

Popularity9

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~83 days

Recently: every ~122 days

Total

13

Last Release

57d ago

Major Versions

v1.4.0 → v2.0.12023-11-05

v2.0.2 → v3.0.02024-07-27

v3.1.0 → v4.0.02024-11-10

v4.0.0 → v5.0.02025-02-10

v5.1.0 → v6.0.02026-03-09

### Community

Maintainers

![](https://www.gravatar.com/avatar/3b5d9484a14b3718c89b908f5dfc3560c4cbf0c4a879ea77a53c708aead2b2f4?d=identicon)[buexplain](/maintainers/buexplain)

---

Top Contributors

[![buexplain](https://avatars.githubusercontent.com/u/12883364?v=4)](https://github.com/buexplain "buexplain (52 commits)")

### Embed Badge

![Health badge](/badges/buexplain-netsvr-protocol/health.svg)

```
[![Health](https://phpackages.com/badges/buexplain-netsvr-protocol/health.svg)](https://phpackages.com/packages/buexplain-netsvr-protocol)
```

###  Alternatives

[naxeem/thaana-transliterator

Thaana transliterator

202.5k](/packages/naxeem-thaana-transliterator)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
