Web

圈组消息更新

更新时间: 2024/03/14 19:21:13

QChat SDK 的QChatMsgServiceInterface接口提供圈组消息更新的方法,支持在发送消息后更新消息。

前提条件

实现流程

API 调用时序

uml diagram

具体流程

本节仅对上图中标为橙色的流程进行说明,其他流程请参考相关文档。例如:

  1. 接收方在登录圈组前,注册message消息接收事件回调函数和messageUpdate消息更新事件回调函数。

    示例代码如下:

    注册消息接收事件回调
    const qchat = new QChat({
      // 初始化参数
    })
    qchat.on('message',(message)=>{})
    
    注册消息更新事件回调
    const qchat = new QChatSDK({
      ... 
    })
    qchat.on('messageUpdate', function (msg) {
      console.log('receive a messageUpdate', msg)
    })
    
    await qchat.login()
    
    
    
  2. 发送方在发送消息后,调用updateMessage方法更新消息。

    示例代码如下:

    await qchat.qchatMsg.updateMessage({
      "message": {
        "serverId": "{{YOUR_SERVERID}}",
        "channelId": "{{YOUR_CHANNELID}}",
        "type": "text",
        "body": "keqing",
        "ext": "sdsdsd",
        "msgIdClient": "51d63bbe042f15b6117cc44c971e47e7",
        "fromAccount": "ctt1",
        "fromClientType": "Web",
        "fromDeviceId": "78a42adb0249809d864542827fa42e41",
        "fromNick": "123",
        "time": 1643364678578,
        "updateTime": 1643364678578,
        "msgIdServer": "657293",
        "status": 0,
        "historyEnable": true,
        "deliveryStatus": "success"
      },
      "ps": "ps111",
      "ext": "ext111"
    })
    
    
  3. messageUpdate消息更新事件回调触发,将更新后的消息投递至接收方。

API 参考

API
说明
message 消息接收事件回调函数
messageUpdate 消息更新回调函数
updateMessage 更新消息
此文档是否对你有帮助?
有帮助
去反馈
  • 前提条件
  • 实现流程
  • API 调用时序
  • 具体流程
  • API 参考