dqspy04266 2018-08-01 04:40
浏览 74
已采纳

如何在jaxl xmpp ejabberd中发送额外的参数?

I want to send some extra parameters to xmpp server. but not getting those extra parameters in msg. using https://github.com/jaxl/JAXL , https://www.ejabberd.im/

I'm trying with this method which is inside jaxl.php.

public function send_msg($to,$body,$sender_id,$id,$xmpp_msg_attribute,$thread=null, $subject=null) {
    $msg = new XMPPMsg(
        array(
            'id'=>$id,
            'sender_id'=>$sender_id,
            'type'=>'normal', 
            'to'=>$to, 
            'from'=>$this->full_jid->to_string(),
            'attributes'=> 'extra information',
        ), 
        $body,
        $thread,
        $subject
    );
    $this->send($msg);
}

but output sending without extra parameters:

<message xml:lang='en'
         to='7070707070@localhost.com'
         from='9696969696@localhost.com/jaxl#3090b93066351b9a90ebad79bb208745'
         id='5b6137010b0bc'
         xmlns='jabber:client'>
  <body><p>check me</p></body>
</message>

I didn't found attributes , sender_id . i also tried changing attributes -> attrs.

source http://jaxl.readthedocs.io/en/latest/users/xml_objects.html#xmppstanza

  • 写回答

1条回答 默认 最新

  • drbmhd9583 2018-08-01 10:05
    关注

    The Message and Body elements are already defined by XMPP protocols, so you can't add attributes to them.

    But you can add new elements, for example a client can send this, and will be received by the destination:

    <message id='46:941386'
        xml:lang='es'
        type='chat'
        to='user2@localhost'>
      <body>hola</body>
      <xxx aa='asd' bb='qwe'/>
    </message>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥170 如图所示配置eNSP
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效
  • ¥15 悬赏!微信开发者工具报错,求帮改
  • ¥20 wireshark抓不到vlan
  • ¥20 关于#stm32#的问题:需要指导自动酸碱滴定仪的原理图程序代码及仿真
  • ¥20 设计一款异域新娘的视频相亲软件需要哪些技术支持
  • ¥15 stata安慰剂检验作图但是真实值不出现在图上
  • ¥15 c程序不知道为什么得不到结果
  • ¥15 键盘指令混乱情况下的启动盘系统重装