【发布时间】:2016-07-11 12:25:41
【问题描述】:
我使用 openfire 作为 XMPP 服务器并使用 converse 作为客户端库。我想从我的聊天窗口向 openfire 发送一条聊天消息。为此,我想将文本发送到一个 converse 方法,该方法会将消息发送到 XMPP 服务器。 我正在尝试使用以下方式发送消息:
var msg = converse.env.$msg({
from: 'a1@localhost',
to: 'a6@localhost',
type: 'chat',
body: "Hi"
});
converse.send(msg);
但这会在 websocket 的控制台网络中发送以下帧:
message from='a1@localhost' to='a6@localhost' type='chat' body='Hi' xmlns='jabber:client'/>
这不会将消息传输给其他用户,也不会将其存储在表中。我很确定我调用了错误的函数。任何人都可以提供任何帮助。
【问题讨论】:
标签: javascript xmpp chat openfire converse.js