Web client push notifications

Send push notifications from the web client

import { DirectChannel } from '@nexconn/chat';

const channel = new DirectChannel('<Target ID>');

const res = await channel.sendMessage({
  messageType: 'RC:TxtMsg', 
  content: {
    content: 'hello RongCloud!',
    extra: 'Extra information',
  },
  pushConfig: {
    pushContent: 'your pushInfo',
    pushData: 'extra msg',
  },
  onSendBefore(message) {
    console.log('local clientId:', message.clientId);
  },
});

if (res.isOk) {
  
  console.log('success', res.data?.messageId);
} else {
  console.log('failed', res.code, res.msg);
}

Related reference links

send Messages