Files
opsxapi/server/internal/docs/content/10-socketio.md
T
logan 2bb4ef7a95 桌面 GUI 外链修复 + 主题顺序调整(含结构扁平化进行中的工作区基线)
- 集成 tauri-plugin-opener:Cargo/lib.rs/capabilities/npm 四处接线,新增 src/openExternal.ts(桌面走 opener,浏览器回退 window.open,相对路径绝对化)
- 关于页 4 个链接、活动栏官网菜单、代理错误横幅 2 处健康检查链接全部改走 openExternal,桌面端可正常跳转
- 设置→外观 主题顺序调整为 深色/浅色/跟随系统
- release 二进制重编并验证(浏览器实测关于页链接可开文档页)
- 附带工作区中未提交的扁平化重构现状(另一会话进行中)
- homepage 落地页与文档终检通过(8787 / 与 /docs 双 200)
2026-10-16 03:03:36 +08:00

46 lines
1.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
## 连接
1. 填写服务地址(**不含** `/socket.io` 路径),如 `http://127.0.0.1:3000`。
2. 点击 **连接**,状态变为「已连接」后即可收发事件。
## 监听事件
「连接配置」→ **监听事件** 填逗号分隔的事件名:
```text
message, notification
```
留空则接收全部服务端事件(onAny 模式)。事件名在每条日志中标注。
## 发送(emit)
「事件」标签底部的发送区:
- **事件名**:如 `message`
- **参数**:JSON 数组,作为 `socket.emit(event, ...args)` 的参数
```json
["hello", 42]
```
## 连接选项
以 JSON 配置传给 socket.io-client:
```json
{
"path": "/socket.io",
"transports": ["websocket"],
"auth": { "token": "{{token}}" }
}
```
| 选项 | 说明 |
| --- | --- |
| path | 服务端挂载路径,默认 `/socket.io` |
| transports | `websocket` / `polling`,默认两者皆可 |
| auth | 握手鉴权载荷,支持 `{{变量}}` |
> **提示**:浏览器直连外部站点同样受 CORS 限制,Socket.IO 服务端需配置对应 origin,或把服务与本工具部署在同源下。