RongIMLib View Markdown
    Preparing search index...

    Function insertMessage

    • 向本地插入一条消息

      Parameters

      Returns Promise<RCResult<IAReceivedMessage>>

      本接口仅适用 Electron 平台,插入消息到本地数据库,不发送到服务器 注意:插入消息时,messageUId 将不会存入数据库

      5.4.0

      options = {}

      插入消息示例:

      const conversation = {
      conversationType: RongIMLib.ConversationType.PRIVATE,
      targetId: 'targetId',
      };
      const message = new RongIMLib.TextMessage({ content: 'hello' });
      const options = {
      searchContent: 'hello',
      };
      const res = await RongIMLib.electronExtension.insertMessage(conversation, message, options);
      console.info('插入消息结果:', res);