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>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器