Sự kiện
Nhận sự kiện realtime: Socket.IO, SSE, polling. · 3 endpoint
Danh mục loại sự kiện
GET
/api/v1/events/typesKhông cần API keyLệnh mẫu
bash
curl "http://127.0.0.1:9900/api/v1/events/types"Lấy sự kiện sau một mốc seq (polling)
GET
/api/v1/eventsScope: events:subscribeGọi lặp lại với since = pagination.next_since. Sự kiện được giữ 7 ngày / 50.000 bản ghi (đổi trong Cài đặt).
Tham số
sincequery · tuỳ chọn | integer ≥ 0 · default 0 | seq cuối cùng đã nhận |
limitquery · tuỳ chọn | integer ≥ 1 · ≤ 1000 · default 200 | |
typesquery · tuỳ chọn | string[] max 50 items | Lọc loại sự kiện, vd: message.*,friend.request.received |
account_idsquery · tuỳ chọn | string[] max 200 items |
Lệnh mẫu
bash
curl "http://127.0.0.1:9900/api/v1/events" \
-H "Authorization: Bearer dpk_xxx"Luồng sự kiện Server-Sent Events
GET
/api/v1/events/streamScope: events:subscribeMỗi sự kiện: id: <seq>, event: <type>, data: <json>. Kết nối lại với header Last-Event-ID hoặc ?since= để nhận phần bị lỡ. Comment : ping mỗi 15 giây.
Tham số
sincequery · tuỳ chọn | integer ≥ 0 | |
typesquery · tuỳ chọn | string[] max 50 items | Lọc loại sự kiện, vd: message.*,friend.request.received |
account_idsquery · tuỳ chọn | string[] max 200 items |
Lệnh mẫu
bash
curl "http://127.0.0.1:9900/api/v1/events/stream" \
-H "Authorization: Bearer dpk_xxx"