【发布时间】:2018-02-28 17:24:41
【问题描述】:
我正在使用 Strophe.js 连接 angular4 中的 XMPP 服务器。 connection.addHandler() 收到一条消息。我在连接成功后添加了这个监听器。
connection.addHandler(this.receiveMessage, null, 'message');
请说出我遗漏或不正确的地方。
【问题讨论】:
标签: angular xmpp ejabberd strophe.js
我正在使用 Strophe.js 连接 angular4 中的 XMPP 服务器。 connection.addHandler() 收到一条消息。我在连接成功后添加了这个监听器。
connection.addHandler(this.receiveMessage, null, 'message');
请说出我遗漏或不正确的地方。
【问题讨论】:
标签: angular xmpp ejabberd strophe.js
确保您的 receivedMessage 函数返回 true 以便在您收到新消息时继续被调用。如果它没有返回true,它只会被调用一次,你必须通过connection.addHandler()再次添加它。
【讨论】: