我正在使用openfire和strophe js在网站上进行聊天。 我想集成像whatsapp这样的消息查看功能。但是我没有得到如何使用strophe js实现xep-0333。请帮忙。
谢谢
答案 0 :(得分:0)
这里是如何使用XEP-0333的现成方法的示例,尤其是对于已交付和已读取状态:
Strophe.addNamespace('CHAT_MARKERS', "urn:xmpp:chat-markers:0");
...
sendDeliveredMarker: function(to, from, originalMessageId) {
var stanzaParams = {
type: 'chat',
from: from,
id: "<id>",
to: to
};
var messageStanza = $msg(stanzaParams);
messageStanza
.c('received', {
xmlns: "urn:xmpp:chat-markers:0",
id: originalMessageId
})
.up();
this.xmppClient.send(messageStanza);
},
sendReadMarker: function(to, from, originalMessageId) {
var stanzaParams = {
type: 'chat',
from: from,
id: "<id>",
to: to
};
var messageStanza = $msg(stanzaParams);
messageStanza
.c('displayed', {
xmlns: "urn:xmpp:chat-markers:0",
id: originalMessageId
})
.up();
this.xmppClient.send(messageStanza);
},