From 2c0ac124d7e29369c173a081edfb662bf5d976ae Mon Sep 17 00:00:00 2001 From: XuqmGroup Date: Wed, 29 Apr 2026 15:46:39 +0800 Subject: [PATCH] =?UTF-8?q?docs(sdk):=20=E6=B7=BB=E5=8A=A0=20Android=20SDK?= =?UTF-8?q?=20=E6=96=87=E6=A1=A3=E5=92=8C=20API=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E8=A7=84=E8=8C=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增 Android SDK 使用文档,包含模块结构、集成方式和快速开始指南 - 添加 SDK API 重设计规范,统一初始化和登录接口设计 - 补充安全设计规范,完善 UserSig 鉴权和敏感数据处理方案 - 创建平台 REST API 规范,定义服务端到服务端的调用接口 - 添加离线推送架构设计,集成各大厂商推送服务与 IM 联动方案 --- README.md | 2 -- src/core/endpoints.ts | 2 ++ src/core/sdk.ts | 3 ++- src/im/ImClient.ts | 3 ++- src/types/index.ts | 2 -- 5 files changed, 6 insertions(+), 6 deletions(-) create mode 100644 src/core/endpoints.ts diff --git a/README.md b/README.md index 8ec6b9a..7fb28a7 100644 --- a/README.md +++ b/README.md @@ -39,8 +39,6 @@ import { init } from '@xuqm/vue3-sdk' init({ appKey: 'ak_your_app_key', appSecret: 'as_your_app_secret', - apiBaseUrl: 'https://api.xuqm.com', - imBaseUrl: 'wss://im.xuqm.com', debug: import.meta.env.DEV, }) ``` diff --git a/src/core/endpoints.ts b/src/core/endpoints.ts new file mode 100644 index 0000000..988b562 --- /dev/null +++ b/src/core/endpoints.ts @@ -0,0 +1,2 @@ +export const DEFAULT_API_BASE_URL = 'https://dev.xuqinmin.com' +export const DEFAULT_IM_WS_URL = 'wss://dev.xuqinmin.com/ws/im' diff --git a/src/core/sdk.ts b/src/core/sdk.ts index e178a64..263f38b 100644 --- a/src/core/sdk.ts +++ b/src/core/sdk.ts @@ -1,5 +1,6 @@ import type { SDKConfig } from '../types' import { configureHttp } from './http' +import { DEFAULT_API_BASE_URL } from './endpoints' let _config: SDKConfig | null = null let _token: string | null = null @@ -7,7 +8,7 @@ let _userId: string | null = null export function init(config: SDKConfig) { _config = config - configureHttp(config.apiBaseUrl, () => _token) + configureHttp(DEFAULT_API_BASE_URL, () => _token) if (config.debug) console.log('[XuqmSDK] initialized', config.appKey) } diff --git a/src/im/ImClient.ts b/src/im/ImClient.ts index 796276f..6ed1618 100644 --- a/src/im/ImClient.ts +++ b/src/im/ImClient.ts @@ -1,5 +1,6 @@ import type { ImMessage, SendMessageParams, ImEventMap } from '../types' import { getConfig, getToken, getUserId } from '../core/sdk' +import { DEFAULT_IM_WS_URL } from '../core/endpoints' type EventListener = ImEventMap[K] @@ -35,7 +36,7 @@ export class ImClient { if (this.destroyed) return const config = getConfig() const token = getToken() - const url = `${config.imBaseUrl}/ws/im?token=${token ?? ''}` + const url = `${DEFAULT_IM_WS_URL}?token=${token ?? ''}` this.ws = new WebSocket(url) diff --git a/src/types/index.ts b/src/types/index.ts index 09440d4..e258175 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -1,8 +1,6 @@ export interface SDKConfig { appKey: string appSecret: string - apiBaseUrl: string - imBaseUrl: string debug?: boolean }