Web client push notifications

Send push notifications from the web client

const conversation = {
    conversationType: RongIMLib.ConversationType.PRIVATE,  // One-to-one chat
    targetId: '<Target ID>', 
}
const message = new RongIMLib.TextMessage({
    content: 'hello RongCloud!', 
    extra: 'Extra information'
});
const options = {
    pushContent:  'your pushInfo', // Push notification content
    pushData: 'extra msg', // Non-display data in remote push, handled by mobile as needed
}

// Send message
RongIMLib.sendMessage(conversation, message, options).then(res => {
  if (res.code === RongIMLib.ErrorCode.SUCCESS) {
    // Message sent successfully, update the message status in the list using the messageId from the result.
    console.log('Message sent successfully', res.data)
  } else {
    console.log('Message failed to send', res.code, res.msg)
  }
})

Related reference links

https://docs.rongcloud.io/web-imlib/message/send