curl -X GET "http://localhost:5001/route?intranet=0"
const response = await fetch('http://localhost:5001/route?intranet=0');
const data = await response.json();
console.log(data);
import requests
response = requests.get('http://localhost:5001/route', params={'intranet': 0})
data = response.json()
print(data)
package main
import (
"encoding/json"
"fmt"
"net/http"
)
func main() {
resp, err := http.Get("http://localhost:5001/route?intranet=0")
if err != nil {
panic(err)
}
defer resp.Body.Close()
var result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
fmt.Printf("%+v\n", result)
}
{
"tcp_addr": "127.0.0.1:5100",
"ws_addr": "ws://127.0.0.1:5200",
"wss_addr": "wss://127.0.0.1:5300"
}
路由管理
获取用户 IM 地址
获取用户的 IM 连接地址
GET
/
route
curl -X GET "http://localhost:5001/route?intranet=0"
const response = await fetch('http://localhost:5001/route?intranet=0');
const data = await response.json();
console.log(data);
import requests
response = requests.get('http://localhost:5001/route', params={'intranet': 0})
data = response.json()
print(data)
package main
import (
"encoding/json"
"fmt"
"net/http"
)
func main() {
resp, err := http.Get("http://localhost:5001/route?intranet=0")
if err != nil {
panic(err)
}
defer resp.Body.Close()
var result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
fmt.Printf("%+v\n", result)
}
{
"tcp_addr": "127.0.0.1:5100",
"ws_addr": "ws://127.0.0.1:5200",
"wss_addr": "wss://127.0.0.1:5300"
}
概述
获取用户的 IM 连接地址,包括 TCP、WebSocket 和 WebSocket Secure 地址。查询参数
integer
默认值:0
是否返回内网地址
0- 返回外网地址1- 返回内网地址
curl -X GET "http://localhost:5001/route?intranet=0"
const response = await fetch('http://localhost:5001/route?intranet=0');
const data = await response.json();
console.log(data);
import requests
response = requests.get('http://localhost:5001/route', params={'intranet': 0})
data = response.json()
print(data)
package main
import (
"encoding/json"
"fmt"
"net/http"
)
func main() {
resp, err := http.Get("http://localhost:5001/route?intranet=0")
if err != nil {
panic(err)
}
defer resp.Body.Close()
var result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
fmt.Printf("%+v\n", result)
}
{
"tcp_addr": "127.0.0.1:5100",
"ws_addr": "ws://127.0.0.1:5200",
"wss_addr": "wss://127.0.0.1:5300"
}
响应字段
string
必填
TCP 连接地址,格式为
host:portstring
必填
WebSocket 连接地址,格式为
ws://host:portstring
必填
WebSocket Secure 连接地址,格式为
wss://host:port状态码
| 状态码 | 说明 |
|---|---|
| 200 | 成功获取 IM 连接地址 |
| 500 | 服务器内部错误 |
⌘I

