mirror of
https://github.com/WuKongIM/WuKongIMDocs
synced 2025-05-31 05:24:10 +00:00
1.3 KiB
1.3 KiB
title, order, nav
title | order | nav | ||||
---|---|---|---|---|---|---|
基础 | -1 |
|
基础
API 规则:
所有 API http 状态码 200 为一定执行成功了(所以有些不需要返回json的接口只需要判断http状态为200即认为成功
),其他为失败,400 为参数错误,500 为服务器错误
如果是 400, 会返回错误信息,格式如下:
{
"msg": "错误信息", // 错误的提示
"status": 400 // 业务错误的状态码
}
所以文档只列出成功的响应参数。
长连接地址获取
获取客户端连接悟空 IM的地址
GET /route?uid=xxxx // uid 为用户 ID
成功响应
{
"tcp_addr": "xx.xx.xx.xxx:xx", // tcp连接地址
"ws_addr": "xx.xx.xx.xxx:xx" // websocket连接地址
}
批量获取连接地址
获取一批用户的连接地址
POST /route/batch
请求参数:
[uid123,uid32323,....] // 用户uid集合
成功响应
[
{
"tcp_addr": "IP:PORT", // tcp连接地址
"ws_addr": "IP:PORT", // websocket连接地址
"uids":[], // 用户uid集合
},
{
"tcp_addr": "IP:PORT", // tcp连接地址
"ws_addr": "IP:PORT", // websocket连接地址
"uids":[], // 用户uid集合
},
...
]