【问题标题】:how to connect custom onmessage handler with Strophe如何将自定义消息处理程序与 Strophe 连接
【发布时间】:2012-04-16 02:27:42
【问题描述】:

我正在使用 Strophe 在 facebook 聊天系统上工作,到目前为止,登录和发送消息都有效。

到目前为止,我可以在 Google Chrome Inspector 控制台中看到已注册传入消息,但是,我目前没有注册任何传入消息处理程序。

我试过了

conn.addHandler(AjaxIM.client.incoming, null, "chat");

-- and --

conn.addHandler(AjaxIM.client.incoming, null, "message", null, null, null);

但这似乎没有任何作用。

非常感谢任何帮助!

【问题讨论】:

    标签: javascript jquery xmpp strophe


    【解决方案1】:

    用途:

    conn.addHandler(handler, null, 'message', 'chat');
    

    见罚款docs ;)

    【讨论】:

    • 我实际上看过它们,但是我找不到有关有效名称和类型值的信息;)
    • @xorinzor 'name' 是一种节,即 'message'、'presence' 或 'iq'。 'type' 匹配节的 'type' 属性,这取决于节的种类。消息见xmpp.org/rfcs/rfc6121.html#message-syntax-type
    猜你喜欢
    • 2022-01-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-05-19
    • 1970-01-01
    • 2014-09-04
    • 1970-01-01
    • 2013-02-04
    相关资源
    最近更新 更多