feat: switch client API branding to MeetingIM

This commit is contained in:
richjohnrambo
2026-08-31 01:22:53 +08:00
parent c6a243ee59
commit 9f647de4d0
48 changed files with 717 additions and 271 deletions
+3 -3
View File
@@ -82,7 +82,7 @@ type audit struct {
func main() {
baseURL := flag.String("base", "https://api.118im.com", "HTTP base URL")
wsURL := flag.String("ws", "wss://api.118im.com/v0/channels", "WebSocket URL")
apiKey := flag.String("apikey", "AQAAAAABAAAoeOI7tA3HsYvdzDhYhZJy", "Tinode API key")
apiKey := flag.String("apikey", "AQAAAAABAAAoeOI7tA3HsYvdzDhYhZJy", "MeetingIM API key")
tenant := flag.String("tenant", "default", "tenant code")
out := flag.String("out", "docs/test/im_frontend_backend_1_11_testenv_results_2026-08-20.md", "report path")
flag.Parse()
@@ -442,7 +442,7 @@ func (a *audit) call(method, path string, body any, token string, idem bool) (in
if err != nil {
return 0, imResp{}, "", err
}
req.Header.Set("X-Tinode-APIKey", a.apiKey)
req.Header.Set("X-MeetingIM-APIKey", a.apiKey)
req.Header.Set("X-IM-Schema", "1")
req.Header.Set("X-Request-ID", "audit-"+strings.ReplaceAll(time.Now().Format("150405.000000000"), ".", ""))
req.Header.Set("X-Tenant-Code", a.tenantCode)
@@ -452,7 +452,7 @@ func (a *audit) call(method, path string, body any, token string, idem bool) (in
if token != "" {
req.Header.Set("Authorization", "Bearer "+token)
if strings.HasPrefix(path, "/v0/file/") {
req.Header.Set("X-Tinode-Auth", "token "+base64.StdEncoding.EncodeToString([]byte(token)))
req.Header.Set("X-MeetingIM-Auth", "token "+base64.StdEncoding.EncodeToString([]byte(token)))
}
}
if idem {
+6 -6
View File
@@ -70,7 +70,7 @@ type wsClient struct {
func main() {
baseURL := flag.String("base", "https://api.118im.com", "HTTP base URL")
wsURL := flag.String("ws", "wss://api.118im.com/v0/channels", "WebSocket URL")
apiKey := flag.String("apikey", "AQAAAAABAAAoeOI7tA3HsYvdzDhYhZJy", "Tinode API key")
apiKey := flag.String("apikey", "AQAAAAABAAAoeOI7tA3HsYvdzDhYhZJy", "MeetingIM API key")
tenant := flag.String("tenant", "default", "tenant code")
out := flag.String("out", "docs/test/im_websocket_testenv_results_2026-08-21.md", "report path")
flag.Parse()
@@ -601,7 +601,7 @@ func (a *audit) uploadFile() (string, error) {
return "", err
}
req.Header.Set("Content-Type", writer.FormDataContentType())
req.Header.Set("X-Tinode-APIKey", a.apiKey)
req.Header.Set("X-MeetingIM-APIKey", a.apiKey)
req.Header.Set("X-Tenant-Code", a.tenantCode)
resp, err := a.client.Do(req)
if err != nil {
@@ -771,7 +771,7 @@ func (c *wsClient) pubAndPeerReceives(peer *wsClient, topic, text string) (int,
"id": id,
"topic": topic,
"head": map[string]any{"mime": "text/plain"},
// Keep this as native Tinode text content. Product-specific x-im
// Keep this as native MeetingIM text content. Product-specific x-im
// headers should be covered by a separate WS message-header matrix.
"content": text,
}}); err != nil {
@@ -945,7 +945,7 @@ func (a *audit) call(method, path string, body any, token string) (int, imResp,
return 0, imResp{}, err
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("X-Tinode-APIKey", a.apiKey)
req.Header.Set("X-MeetingIM-APIKey", a.apiKey)
req.Header.Set("X-Tenant-Code", a.tenantCode)
req.Header.Set("X-IM-Schema", "1")
req.Header.Set("X-Request-ID", "req-ws-audit-"+fmt.Sprintf("%d", time.Now().UnixNano()))
@@ -954,7 +954,7 @@ func (a *audit) call(method, path string, body any, token string) (int, imResp,
}
if token != "" {
req.Header.Set("Authorization", "Bearer "+token)
req.Header.Set("X-Tinode-Auth", "token "+base64.StdEncoding.EncodeToString([]byte(token)))
req.Header.Set("X-MeetingIM-Auth", "token "+base64.StdEncoding.EncodeToString([]byte(token)))
}
resp, err := a.client.Do(req)
if err != nil {
@@ -986,7 +986,7 @@ func (a *audit) report() string {
fmt.Fprintf(&b, "- 用户 B:`%s` / `%s` / `%s`\n", a.userB, a.usernameB, a.phoneB)
fmt.Fprintf(&b, "- API Key 与 Token 已脱敏,不在文档中展开。\n\n")
fmt.Fprintf(&b, "## 2. 总体结论\n\n")
fmt.Fprintf(&b, "本轮专项验证 Tinode WebSocket 真实协议链路,共执行 `%d` 项,通过 `%d` 项,未通过 `%d` 项。\n\n", total, passed, total-passed)
fmt.Fprintf(&b, "本轮专项验证 MeetingIM WebSocket 真实协议链路,共执行 `%d` 项,通过 `%d` 项,未通过 `%d` 项。\n\n", total, passed, total-passed)
fmt.Fprintf(&b, "| ID | 场景 | 方法 | 目标 | 结果 | 备注 |\n| --- | --- | --- | --- | --- | --- |\n")
for _, r := range a.results {
status := "通过"