ErisPulse ConnHub
连接中心模块 —— 管理框架登记的全部 WS/SSE 连接。
基于 ErisPulse 2.10 连接注册表的连接管理模块,提供命令行管理、HTTP API、SSE 事件流与实时面板。
简介
ConnHub 是基于 ErisPulse 架构开发的连接管理模块。ErisPulse 2.10 起连接(服务端 WS / SSE / 出站 WS)统一登记进框架连接注册表,本模块在此基础上提供:
- 连接查询与统计(id / kind / namespace / owner / groups)
- 分组管理与定向广播
- 连接关闭(受归属权限校验约束)
- HTTP API 与 SSE 实时事件流
要求 ErisPulse >= 2.10.0。
效果展示
/conn list |
/conn stats |
|---|---|
安装
epsdk install ErisPulse-ConnHub
命令
| 命令 | 说明 |
|---|---|
/conn |
显示用法 |
/conn list [kind] |
列出连接,kind 可选 server / client / sse |
/conn stats |
连接池各维度统计 |
/conn group add <id> <组名> |
连接加入分组 |
/conn group remove <id> <组名> |
连接移出分组 |
/conn broadcast <组名|*> <消息> |
向分组(* 为全体)广播 |
/conn close <id> |
关闭连接 |
全部命令需要框架主人权限。
HTTP API
| 方法 | 路径 | 说明 |
|---|---|---|
| GET | /ConnHub/api/connections |
连接列表 |
| GET | /ConnHub/api/stats |
连接统计 |
| POST | /ConnHub/api/broadcast |
广播,body: {"group": "...", "data": {...}, "timeout": 10} |
| POST | /ConnHub/api/close |
关闭,body: {"id": "...", "force": false} |
| GET | /ConnHub/events |
SSE 事件流(登记/注销/分组变化 + 周期快照) |
使用示例
from ErisPulse import connections
# 任意模块:查看当前连接
for conn in connections.list():
print(conn.id, conn.kind, conn.owner, conn.groups)
# 向分组广播(ConnHub 提供的命令与 API 等价于以下调用)
result = await connections.broadcast({"text": "通知"}, group="room:1")
print(result.sent, result.failed)
配置说明
[ConnHub]
api_enabled = true # 启用 HTTP API 与 SSE
view_enabled = true # 注册 Dashboard 视图
allow_force_close = false # 允许强制关闭其他模块归属的连接
snapshot_interval_secs = 15 # 面板快照推送间隔秒数(0 关闭)
broadcast_timeout = 10.0 # 广播单连接发送超时(秒)
top_max = 20 # 列表单次展示上限
render_card = true # 报表用 Takumi 渲染为卡片
theme = "doodle" # 卡片风格 (doodle/editorial)
| 配置项 | 类型 | 默认值 | 说明 |
|---|---|---|---|
api_enabled |
bool | true |
启用 HTTP API 与 SSE 事件流 |
view_enabled |
bool | true |
注册 Dashboard 连接面板视图 |
allow_force_close |
bool | false |
允许关闭其他模块归属的连接 |
snapshot_interval_secs |
int | 15 |
面板快照推送间隔(秒,0 关闭) |
broadcast_timeout |
float | 10.0 |
广播单连接发送超时(秒) |
top_max |
int | 20 |
列表单次展示上限 |
render_card |
bool | true |
报表用 Takumi 渲染为卡片 |
theme |
str | doodle |
卡片风格 (doodle/editorial) |
注意事项
- 连接关闭权归创建者模块:关闭其他模块的连接需开启
allow_force_close - 面板以 Dashboard 视图形式提供(需安装 Dashboard 模块),SSE 事件流地址
/ConnHub/events - 模块卸载时其名下连接由框架自动关闭(2.10 行为)
参考链接
Metadata
Release files for ErisPulse-ConnHub 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| erispulse_connhub-0.1.5.tar.gz | 20.6 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| erispulse_connhub-0.1.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 41.4 kB
Release files / erispulse_connhub-0.1.5.tar.gz
| Download URL | erispulse_connhub-0.1.5.tar.gz |
|---|---|
| Size | 20.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5b0acd6bfcdd3c84f106c23b4172826c3bc370c160f774d2e4340f21495c673e
|
|
BLAKE2b-256 checksum How to use checksums |
aa521426afed729b95a55ab7c10c0ee040c19a8eee9a1675b1c37021e13c36c2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.
Transparency logRelease files / erispulse_connhub-0.1.5-py3-none-any.whl
| Download URL | erispulse_connhub-0.1.5-py3-none-any.whl |
|---|---|
| Size | 20.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
84b5c22d06937666fc1fad72d43ab3d1f30308203c66e591afd68be2cff6cc4c
|
|
BLAKE2b-256 checksum How to use checksums |
495fe42c199cafd8ce74288aadabd638e5d8302e045000287dc7da6fee5d10e1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.
Transparency logSecurity for ErisPulse-ConnHub 0.1.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for erispulse_connhub-0.1.5.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.