Sync
SSE 实时同步流
Server-Sent Events 端点,用于持续实时同步。
协议流程:
- 客户端连接:GET /api/sync/stream?token={jwt}&since={cursor}
- 服务端追赶:发送游标之后的所有事件(event: sync)
- 服务端发送 event: caught_up 标记追赶完成
- 实时推送:新事件通过 Redis pub/sub 推送(event: sync)
- 心跳:每 25 秒发送 event: heartbeat
SSE 事件类型:
- sync — 同步事件数据
- caught_up — 追赶完成,进入实时模式
- heartbeat — 保活信号
认证通过 ?token= 查询参数传递(不使用 Authorization header)。
get/sync/stream
Request
- Base URLhttp://localhost:3200/api
- Authnone declared
- TypeScriptA function with typed inputs. Its response is checked against the schema.
Query parameters
tokenstring required
JWT 认证 token
sincestring
游标(同步事件 ID),从此处恢复
Response
SSE 事件流
Changes
No recorded changes to this operation across all 4 revisions of this API.