style: use sendMessageAck in recv notification

This commit is contained in:
Adhiraj Singh
2021-11-11 15:14:42 +05:30
parent 71664756dd
commit 7b5bb1f428

View File

@@ -465,25 +465,7 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
ws.on('CB:receipt', handleReceipt)
ws.on('CB:notification', async(node: BinaryNode) => {
const sendAck = async() => {
const stanza: BinaryNode = {
tag: 'ack',
attrs: {
class: 'notification',
id: node.attrs.id,
type: node.attrs.type,
to: node.attrs.from
}
}
if(node.attrs.participant) {
stanza.attrs.participant = node.attrs.participant
}
await sendNode(stanza)
logger.debug({ attrs: stanza.attrs }, 'ack notification')
}
await sendAck()
await sendMessageAck(node, { class: 'notification', type: node.attrs.type })
const msg = processNotification(node)
if(msg) {