【问题标题】:I'm developing an Angular6 app, i am trying to send message from web using Strophe我正在开发一个 Angular6 应用程序,我正在尝试使用 Strophe 从网络发送消息
【发布时间】:2020-03-30 04:25:18
【问题描述】:

这是我的聊天服务的方法,

sendCustomMessage(to, from, body) {
    const query = $msg({to: to, from: from, type: 'chat'}).c("body").t(body);
    console.log("query", query)
    this._xmppConnection.send(query);
   }

我遇到了 "$msg" 的问题。问题是“找不到名称'$msg'.ts(2304)”...请帮我解决一下

【问题讨论】:

  • sendCustomMessage(to, from, body) { const query = $msg({to: to, from: from, type: 'chat'}).c("body").t(body ); console.log("query", query) this._xmppConnection.send(query); }

标签: typescript xmpp ejabberd strophe strophe.js


【解决方案1】:

请这样做。问题在于变量的范围。 从 'strophe.js' 导入 { Strophe, $pres, $msg, $iq };

【讨论】:

    猜你喜欢
    • 2020-02-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-03-26
    • 1970-01-01
    • 2021-12-23
    • 1970-01-01
    • 2016-11-19
    相关资源
    最近更新 更多