Files
opsxapi/homepage/content/08-websocket.md
T
Logan.Li 3cb9545121 refactor(homepage): 官网/文档/定价源码迁出程序 + 新增独立授权与激活页 /license
- 官网源码归拢到 homepage/(index/pricing/terms/license + content/ + assets/ + docs-assets/),
  删除程序内 go:embed 的 server/internal/{site,docs},后端仅静态托管 homepage/dist 做本地预览
- 新增独立静态页 /license(授权与激活):交付与激活四步(邮件交付授权码)、
  在线授权码 LIC- 与离线许可证 LICOFF- 对比、授权服务器 licence.rlwj.cn 通信范围说明、
  授权类型与价格、10 条授权 FAQ
- tools/homepage-build 支持可选单页,产出 <name>.html 与 <name>/index.html
- 导航/页脚接入 /license,跨页锚点补 / 前缀,页脚底栏文案同步为静态站口径
2026-10-16 04:16:16 +08:00

35 lines
1.3 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. 填写 `ws://` 或 `wss://` 地址。
2. 点击 **连接**;状态点变绿(已连接)后即可收发消息。
3. 再次点击按钮即断开。
## 消息收发
- **消息日志**:接收(绿)/ 发送(蓝)/ 系统(灰)/ 错误(红)分色展示,顶部统计 ↑↓ 条数与连接时长。
- **发送框**:支持 JSON / 纯文本;**⌘/Ctrl + Enter** 快速发送;「格式化 JSON」一键美化。
## 子协议
「握手配置」标签中的**子协议**填逗号分隔列表,例如:
```text
graphql-transport-ws, v1.json
```
## 自定义握手 Header(隧道模式)
浏览器原生 WebSocket **不能**携带自定义 Header(如 `Authorization`、`X-API-Key`)。OpsxAPI 的处理方式:
1. 「握手配置」中填写 Header 后,工具自动改走**本地 Gin 隧道**:
- 浏览器 → Gin `/v1/proxy/ws/attach`(普通 WS)
- Gin → 目标服务器(携带你填的全部 Header)
2. 不填 Header 时直连目标,零额外开销。
> **注意**:隧道要求本地 Gin 服务(:8787)在运行,即用 `./run.sh web` / `gui` 启动的默认形态。
## 调试技巧
- 消息过多时点「清空」;日志上限 500 条,超出自动滚动淘汰。
- 把常用报文保存在「说明」里,或为不同报文建多个 WS 请求节点。