Javascript XMPP ONLOSTNAME属性未出现

Javascript XMPP ONLOSTNAME属性未出现,javascript,xmpp,openfire,strophe,Javascript,Xmpp,Openfire,Strophe,我正在使用strophe.js(javascript)和openfire作为服务器构建一个XMPP聊天应用程序 应用程序运行良好;但是,我无法显示已收集名册的“名称”属性。该名称未定义或显示花名册的jid XMPP数据库中存储的名称在哪里?如何更改它?我应该在所有xmpp用户存储的memeber表中添加姓名吗?您可以使用strophe.js设置联系人的姓名。只需发送此查询: <iq from='juliet@example.com/balcony' id='gb3sv487'

我正在使用strophe.js(javascript)和openfire作为服务器构建一个XMPP聊天应用程序

应用程序运行良好;但是,我无法显示已收集名册的“名称”属性。该名称未定义或显示花名册的jid


XMPP数据库中存储的名称在哪里?如何更改它?我应该在所有xmpp用户存储的memeber表中添加姓名吗?

您可以使用strophe.js设置联系人的姓名。只需发送此查询:

<iq from='juliet@example.com/balcony'
       id='gb3sv487'
       type='set'>
     <query xmlns='jabber:iq:roster'>
       <item jid='romeo@example.net'
             name='MyRomeo'/>
     </query>
   </iq>

下面是Javascript:

var iq = $iq({type: 'set'}).c('query', {xmlns: 'jabber:iq:roster'}).c("item",  {jid:'romeo@example.net',name:'MyRomeo'});
con.sendIQ(iq);

con.send($pres({to: 'test@test.com', type: "subscribe"}))

谢谢,我写这封信还是有困难javascript@mikek如何使用stophejs在nick name上显示当前集合
var iq = $iq({type: 'set'}).c('query', {xmlns: 'jabber:iq:roster'}).c("item",  {jid:'romeo@example.net',name:'MyRomeo'});
con.sendIQ(iq);

con.send($pres({to: 'test@test.com', type: "subscribe"}))