netlify.toml Documentation

Official TypeScript developer resources and documentation for openimsdk/netlify.toml. Verified technical context for AI.

0 stars TypeScript TypeScript 1 file · ~5,316 tokens
RAW Doc

1. Project Overview & Quickstart (openimsdk/netlify.toml)

netlify.toml

Open-source repository openimsdk/netlify.toml

Repository Details

Note: High-volume repository documentation is actively indexed and synchronized by YakaAI.

2. Official Technical Reference & Guides (openimsdk/docs)

File: README.md

OpenIMSDK Documentation



This repository contains the source for the official OpenIMSDK documentation. It provides implementation guides and API documentation for OpenIMClientSDK, OpenIMServer, ChatServer, and the server-side Platform API in English and Simplified Chinese.

OpenIMSDK is the umbrella project for the OpenIMClientSDK client SDKs and the OpenIMServer core IM server. ChatServer is the business extension server; it is not presented as a standalone “Chat” product. The source repositories are maintained by the OpenIMSDK organization.

Resource Link
Documentation docs.openim.io
Simplified Chinese documentation docs.openim.io/zh
OpenIMSDK website openim.io
Enterprise edition openim.io/enterprise
OpenIMSDK on GitHub github.com/openimsdk

Documentation scope

The public documentation currently covers:

  • OpenIMSDK concepts, OpenIMServer and ChatServer deployment guidance, and integration workflows
  • iOS SDK
  • Flutter SDK
  • Electron SDK
  • JavaScript SDK for lightweight Web and Mini Program runtimes
  • JavaScript SDK (WASM) for full Web IM applications and Electron renderer processes
  • Platform API, including authentication, users, relationships, groups, conversations, messages, Webhooks, and operational APIs

Only reviewed platforms and pages appear in the public navigation, search index, and sitemap. Draft structures for additional platforms may remain in the repository without being published.

Capabilities marked Enterprise require the corresponding commercial edition or delivery. See the Enterprise edition for product information, or contact [email protected] for licensing and commercial support.

Technology

The documentation application is built with:

  • Next.js and React
  • Fumadocs for MDX content integration
  • TypeScript
  • Tailwind CSS
  • pnpm and Corepack

English and Simplified Chinese pages share one audited route structure. Navigation, search indexes, localized SDK packages, and publication metadata are derived from reviewed MDX and structural records.

Local development

Requirements

  • Node.js 22.12 or later
  • Corepack
  • The pnpm version declared in package.json

Start the development server

bash
corepack enable
pnpm install --frozen-lockfile
cp .env.example .env.local
pnpm dev

Open the local site at:

Repository structure

text
api/chat/platform-api/  Versioned OpenAPI source documents
app/                    Next.js routes, metadata, search, and sitemap
content/docs/           English SDK and Platform API MDX
content/en/docs/guides/ Reviewed English guide snapshots
content/zh/docs/        Simplified Chinese MDX and guide snapshots
data/structure/         Navigation, ownership, scope, and review records
docs/                   Current architecture and authoring documentation
public/                 Versioned images, brand assets, and downloads
scripts/                Active validation, synchronization, and build tools
src/components/         Documentation and site UI
src/generated/          Committed route, navigation, search, and locale data

Public URLs do not expose internal product-version directories. For example:

text
/sdk/wasm/overview
└── content/docs/chat/sdk/wasm/overview.mdx

/zh/sdk/wasm/overview
└── content/zh/docs/chat/sdk/wasm/overview.mdx

Generated files are build inputs, not editorial evidence. Documentation facts must be verified against the pinned OpenIMClientSDK declarations, OpenIMServer definitions, OpenAPI documents, or the immutable sources recorded in the relevant audit file.

Authoring and localization

Read CONTRIBUTING.md and the content authoring guide before changing documentation pages.

The client SDK localization workflow is Chinese-first:

  1. Review the complete Simplified Chinese page and its technical evidence.
  2. Edit and audit the page manually.
  3. Translate the reviewed page into fluent English.
  4. Verify API names, parameters, examples, results, events, and links against the target SDK.
  5. Publish the English route only after its review record is complete.

Final MDX prose must be reviewed page by page. Scripts may update deterministic structure and generated metadata, but they must not generate or machine-translate final documentation text.

Validation

Run the complete validation suite before submitting or publishing changes:

bash
pnpm check
pnpm build

pnpm check includes linting, TypeScript validation, content integrity checks, SDK publication audits, example checks, OpenAPI linting, and Platform API tests. pnpm build validates the production application. Local and Docker builds also prepare the standalone server output; managed platforms use their own Next.js runtime.

Frequently used commands:

Command Purpose
pnpm dev Synchronize derived content and start the development server.
pnpm content:status Report publication status by product and page type.
pnpm content:sync Rebuild localized SDK packages and search indexes.
pnpm content:metadata Refresh route and navigation metadata from reviewed frontmatter.
pnpm content:check Validate routes, links, navigation, frontmatter, and search records.
pnpm structure:report Refresh the active route and navigation report.
pnpm check Run the complete quality and content validation suite.
pnpm build Create the production Next.js build and standalone output.

Configuration

Copy .env.example to .env.local for local development. The following public environment variables configure canonical URLs and external navigation:

dotenv
NEXT_PUBLIC_SITE_URL=https://docs.openim.io
NEXT_PUBLIC_WEBSITE_URL=https://openim.io/
NEXT_PUBLIC_ENTERPRISE_URL=https://openim.io/enterprise/
NEXT_PUBLIC_LEGACY_DOCS_URL=https://openim-docs-legacy.vercel.app
NEXT_PUBLIC_GITHUB_URL=https://github.com/openimsdk
NEXT_PUBLIC_EDIT_BASE_URL=https://github.com/openimsdk/docs/edit/main

NEXT_PUBLIC_LEGACY_DOCS_URL controls the archived-documentation link in the global navigation. Leave NEXT_PUBLIC_EDIT_BASE_URL empty if edit links should not be displayed.

Deployment

Netlify

The production site at docs.openim.io is deployed from main through Netlify. netlify.toml fixes the build command, publish directory, Node.js version, and Next.js Runtime in version control.

Every production deployment must reach ready and pass smoke tests for the home pages, SDK and Platform API routes, search, redirects, Sitemap, and Robots. See the deployment audit for the verified production chain.

Vercel

The repository includes vercel.json. Configure the production environment variables, import the repository into Vercel, and use the committed pnpm lockfile. Vercel runs:

bash
pnpm install --frozen-lockfile
pnpm build

Docker and standalone Node.js

Build and run the maintained container image with:

bash
docker compose up --build

For a direct Node.js deployment:

bash
corepack enable
pnpm install --frozen-lockfile
pnpm build
PORT=3000 HOSTNAME=0.0.0.0 pnpm start

The production server is generated at .next/standalone/server.js.

Contributing

Contributions that improve correctness, examples, navigation, accessibility, or developer experience are welcome. Pull requests should identify the affected documentation area, the SDK or server evidence used, and the validation commands that were run.

See:

Support and security

Use GitHub Issues for reproducible documentation defects and content corrections. For product, deployment, licensing, or commercial support, contact [email protected].

Do not report security vulnerabilities in a public issue. Follow the private reporting process in SECURITY.md.

License

This documentation project is licensed under the MIT License.


File: content/zh/docs/chat/sdk/electron/message/create-media-from-full-path.mdx


title: '从完整路径创建媒体消息' sourcePath: '/sdk/electron/message/create-media-from-full-path'

Electron FFI 提供一组从本地完整文件路径创建媒体消息的 API。它们适合桌面端已经拿到磁盘绝对路径的场景,例如系统文件选择器返回的路径。浏览器与 Electron WASM 形态应使用对应的 *ByFile / *ByURL 方法;以图片为例,分别见使用文件创建图片消息和使用 URL 创建图片消息。需要独立上传文件时,见上传文件。

创建得到 MessageItem 后,发送步骤与共享消息模型相同,调用 sendMessage();发送参数与事件见发送消息。

支持的方法

方法 用途
createImageMessageFromFullPath(imagePath) 从本地图片绝对路径创建图片消息。
createSoundMessageFromFullPath(params) 从本地音频绝对路径创建语音消息。
createVideoMessageFromFullPath(params) 从本地视频与封面图绝对路径创建视频消息。
createFileMessageFromFullPath(params) 从本地文件绝对路径创建普通文件消息。

这些方法只创建消息对象,不会自动发送,也不会触发新消息事件。

图片消息

createImageMessageFromFullPath() 直接接收图片文件的绝对路径字符串。

ts
const { data: message } = await openimsdk.createImageMessageFromFullPath(
  '/absolute/path/to/photo.jpg',
);

await openimsdk.sendMessage({
  recvID,
  groupID: '',
  message,
});

语音消息

参数说明

参数 类型 是否必填 说明
soundPath string 是 音频文件的绝对路径。
duration number 是 音频时长;必须传整数,不要传小数。
ts
const { data: message } = await openimsdk.createSoundMessageFromFullPath({
  soundPath: '/absolute/path/to/voice.m4a',
  duration: 3200,
});

视频消息

参数说明

参数 类型 是否必填 说明
videoPath string 是 视频文件的绝对路径。
videoType string 是 视频类型,例如 mp4。
duration number 是 视频时长;必须传整数,不要传小数。
snapshotPath string 是 视频封面图的绝对路径。
ts
const { data: message } = await openimsdk.createVideoMessageFromFullPath({
  videoPath: '/absolute/path/to/clip.mp4',
  videoType: 'mp4',
  duration: 12000,
  snapshotPath: '/absolute/path/to/cover.jpg',
});

文件消息

参数说明

参数 类型 是否必填 说明
filePath string 是 文件的绝对路径。
fileName string 是 展示给会话成员的文件名。
ts
const { data: message } = await openimsdk.createFileMessageFromFullPath({
  filePath: '/absolute/path/to/report.pdf',
  fileName: 'report.pdf',
});

调用结果

四个 *FromFullPath 方法的 Promise 成功后,data 都是待发送的 MessageItem。随后的 sendMessage() Promise 成功只代表发送请求完成;对端是否收到消息,以其客户端收到的新消息事件为准。

相关页面


File: content/zh/docs/chat/sdk/electron/logger/upload-logs.mdx


title: '上传日志' sourcePath: '/sdk/electron/logger/upload-logs'

Electron FFI 提供 uploadLogs(),用于把原生侧已落盘的诊断日志上传到当前 OpenIMServer 配置的日志收集链路。浏览器侧的日志配置见 WASM 日志;WASM 包不提供对等的 uploadLogs()。

只在排查问题、用户主动提交诊断信息或运维要求时上传。上传前确认日志中不包含 Token、消息正文或其他敏感字段;需要补充业务上下文时,使用 ex 写入可公开的诊断标记,不要写入凭据。

上传日志

参数说明

参数 类型 是否必填 说明
line number 是 本次上传读取的日志行数或行范围配置,按 Electron FFI SDK 约定填写。
cancelID string 否 取消标识;未传时由 SDK 使用默认值。
ex string 否 附加到本次上传的扩展说明;没有时可不传或传空字符串。
ts
await openimsdk.uploadLogs({
  line: 2000,
  ex: 'desktop-diag-session',
});

调用结果

uploadLogs() 的 Promise 成功表示本次上传请求已完成。它不会修改会话、消息或用户资料,也不会触发业务领域事件。上传失败时记录 errCode、errMsg 和当前用户 ID,便于与 OpenIMServer 侧日志对应;不要在失败日志中再次输出完整日志正文。

相关页面


File: content/zh/docs/chat/sdk/electron/getting-started/authenticate-and-init.mdx


title: '认证与初始化' sourcePath: '/sdk/electron/getting-started/authenticate-and-init'

Electron FFI 形态把 SDK 初始化与用户登录拆开:先用 initSDK() 配置 OpenIMServer 地址和本地运行目录,再用 login() 提交 userID 与 Token。这与 WASM 认证与管理登录会话 中一次性传入 InitAndLoginConfig 的写法不同。

本页只覆盖 Electron FFI 的生命周期 API。连接成功、Token 失效和踢下线等事件的处理边界可参考 WASM 认证页;实际注册时应使用当前 Electron FFI SDK 提供的事件枚举,不要直接复制 WASM 的 SdkEvent 类型。

与 WASM 的差异

步骤 Electron FFI WASM
配置服务地址与运行环境 initSDK(InitConfig) 包含在 login(InitAndLoginConfig) 中
提交用户凭据 login({ userID, token }) 同一 login() 调用
释放原生 SDK unInitSDK() 无对等的公开卸载 API;退出使用 logout()

Electron 渲染层如果走 WASM 形态,请直接按 WASM 认证页接入,不要调用本页的 initSDK()。

初始化 SDK

InitConfig 在初始化时写入服务地址、平台、本地数据目录和日志选项。

参数说明

字段 类型 是否必填 说明
apiAddr string 是 OpenIMServer 的 HTTP API 地址。
wsAddr string 是 OpenIMServer 的 WebSocket 地址。
platformID number 是 当前客户端平台枚举值,需符合 OpenIMServer 的多端登录策略。
dataDir string 是 原生 SDK 本地数据目录的可写绝对路径。
systemType string 是 系统类型标识,按 Electron FFI SDK 约定填写。
logLevel LogLevel 否 日志级别。
logFilePath string 否 日志文件路径。
isLogStandardOutput boolean 否 是否输出到标准输出。
ts
await openimsdk.initSDK({
  apiAddr,
  wsAddr,
  platformID,
  dataDir: '/absolute/path/to/openim-data',
  systemType: 'electron',
  logLevel: LogLevel.Warn,
  isLogStandardOutput: false,
});

initSDK() 的 Promise 成功表示原生 SDK 已完成初始化并可以继续登录;它不会建立用户会话,也不等于连接事件已到达。

登录当前用户

初始化成功后再调用 login()。FFI 登录只接收用户凭据:

参数说明

字段 类型 是否必填 说明
userID string 是 当前 OpenIMSDK 用户 ID,必须与 Token 对应。
token string 是 由可信后端签发的 OpenIMSDK Token。
ts
await openimsdk.login({
  userID,
  token,
});

login() 的 Promise 成功表示登录请求完成;是否已可调用业务 API,仍应结合 OnConnectSuccess 等连接事件判断。事件注册方式见 WASM 认证页。

退出与卸载

用户主动退出或切换账号时,先调用共享的 logout() 结束登录会话,再在需要释放原生资源时调用 unInitSDK()。

ts
await openimsdk.logout();
await openimsdk.unInitSDK();

unInitSDK() 不接收业务参数。切换账号时,先完成旧账号退出与状态清理,再按需重新 initSDK() 并 login();不要并发初始化两个原生实例。

下一步


File: content/zh/docs/chat/sdk/electron/overview.mdx


title: 'OpenIM Electron SDK 概览' sourcePath: '/sdk/electron/overview'

Electron SDK 同时提供 WASM 和 FFI 两种接入形态。共享的用户、会话、群组、消息、通话和事件能力以 WASM SDK 文档 为准;本页只说明形态选择,以及 FFI 形态相对 WASM 多出的 API 与登录参数差异。

SDK 形态分工

接入形态 适用场景 文档去向
WASM 浏览器页面、Electron 渲染进程、WebView、希望与 Web 客户端复用的 UI 直接使用 WASM SDK 的接入与业务指南
FFI 桌面应用打包、原生运行时、需要本地文件全路径或独立 initSDK 生命周期的场景 本 Hub 的专属页 + WASM 共享业务页
WASM + FFI 同一产品同时支持 Web 与 Electron 打包 在业务层封装统一入口,按运行环境选择实现,避免同一用户被两个 SDK 实例重复登录

接入差异(仅 FFI)

WASM 浏览器包通过一次 login(InitAndLoginConfig) 同时传入服务地址、平台和用户凭据。Electron FFI 拆成两步:

  1. initSDK(InitConfig):写入 apiAddr、wsAddr、platformID、dataDir、systemType 和日志选项。
  2. login({ userID, token }):只提交当前用户凭据。

完整参数、示例和 unInitSDK() 见认证与初始化。共享的连接、Token 和踢下线事件监听仍参考 WASM 认证与管理登录会话。

Electron 专属 API(FFI)

能力 API 说明
认证与生命周期 initSDK / login / unInitSDK 认证与初始化
本地全路径媒体消息 createImageMessageFromFullPath 等 从完整路径创建媒体消息
上传诊断日志 uploadLogs 上传日志

浏览器或 Electron WASM 形态不要调用这些 FFI 专用方法;媒体消息应继续使用 WASM 文档中的 *ByFile / *ByURL 路径。

共享能力(链到 WASM)

领域 WASM 入口
快速开始 按运行环境接入、发送第一条消息
用户 用户概览
会话 会话概览
群组 群组概览
消息 消息概览
音视频通话 通话概览
事件 事件概览
日志级别 日志(上传日志见 Electron 专属页)

桌面端注意事项

  • 同时覆盖 Web 与 Electron 时,先定义应用内 IM 适配器,再按环境选择 WASM 或 FFI。
  • 使用 WASM 形态时,打包后仍需验证 openIM.wasm、sql-wasm.wasm 和 wasm_exec.js 可访问。
  • 使用 FFI 形态时,按桌面安装包、权限、dataDir 和升级策略接入,不要套用浏览器 WASM 资源路径。
  • 主进程与渲染进程都需要 IM 状态时,先明确 IPC 边界和会话所有权,避免多实例竞争。
  • 不要把用户 Token 写入 preload 脚本或主进程日志。

File: content/zh/docs/chat/sdk/flutter/group/group-applications/accept-group-application.mdx


title: '接受入群申请' sourcePath: '/sdk/flutter/group/group-applications/accept-group-application'

传入有效的 groupID、申请人 userID 和可选 handleMsg。Future 成功表示服务端完成处理请求,不应直接伪造成员记录。

dart
await OpenIM.iMManager.groupManager.acceptGroupApplication(
  groupID: groupID,
  userID: applicantUserID,
  handleMsg: '欢迎加入',
);

File: content/zh/docs/chat/sdk/flutter/group/group-applications/get-group-application-list-as-applicant.mdx


title: '获取发出的入群申请' sourcePath: '/sdk/flutter/group/group-applications/get-group-application-list-as-applicant'

传入 GetGroupApplicationListAsApplicantReq。Future 成功返回当前用户发出的申请;查询方向与收到的申请不同,分页字段含义相同。

dart
final applications = await OpenIM.iMManager.groupManager
    .getGroupApplicationListAsApplicant(
  GetGroupApplicationListAsApplicantReq(
    groupIDs: [groupID],
    handleResults: [0],
    offset: 0,
    count: 20,
  ),
);

File: content/zh/docs/chat/sdk/flutter/group/group-applications/get-group-application-list-as-recipient.mdx


title: '获取收到的入群申请' sourcePath: '/sdk/flutter/group/group-applications/get-group-application-list-as-recipient'

传入 GetGroupApplicationListAsRecipientReq,设置 groupIDs、handleResults、offset 和 count。Future 成功返回当前用户有权处理的 List<GroupApplicationInfo>。

dart
final applications = await OpenIM.iMManager.groupManager
    .getGroupApplicationListAsRecipient(
  GetGroupApplicationListAsRecipientReq(
    groupIDs: [groupID],
    handleResults: [0],
    offset: 0,
    count: 20,
  ),
);

File: content/zh/docs/chat/sdk/flutter/group/group-applications/get-group-application-unhandled-count.mdx


title: '获取未处理入群申请数' sourcePath: '/sdk/flutter/group/group-applications/get-group-application-unhandled-count'

dart
final count = await OpenIM.iMManager.groupManager
    .getGroupApplicationUnhandledCount(
  GetGroupApplicationUnhandledCountReq(time: 0),
);

查询只返回调用时的未处理数量,不改变申请状态。


File: content/zh/docs/chat/sdk/flutter/group/group-applications/overview-group-applications.mdx


title: '入群申请概览' sourcePath: '/sdk/flutter/group/group-applications/overview-group-applications'

固定 Flutter SDK 提供收到/发出申请、未处理数量、同意和拒绝五个方法,没有角标读取、角标清除或删除申请记录方法。

申请事件通过应用唯一的 OnGroupListener 处理,按 groupID:userID 合并;分页期间发生变化时重置分页。