简体   繁体   English

将自定义编辑的状态发送到XMPP MUC会议室

[英]Sending custom edited presence to XMPP MUC room

Server is Openfire with custom component running and Client is iOS 服务器是运行自定义组件的Openfire,客户端是iOS

1> User1 authenticates and then creates room1 and then sends a
presence to server_comp

2> Server_comp invites User2 to join room1 on behalf of User1

3> User2 accepts the invitation and joins the room.

4> All the message stanza conversation continues well.

I want to notify User2 whenever there is location coordinate changes at User1 client side. 我想在User1客户端发生位置坐标更改时通知User2。 This I want to do through presence stanza. 我想通过状态节来做到这一点。

Now User1 sending presence stanza without mentioning presence.type (available) to the room jid along with location element. 现在,User1发送出席状态节,而未提及到房间jid中的present.type(可用)以及location元素。

The presence stanza from User1 to room is not received at User2. User2不会收到从User1到房间的在线状态节。

I have this delegate implemented, but this never hits. 我已经实现了这个代表,但这从未实现。 What is the use of this delegate? 该委托人有什么用?

-(void)xmppRoom:(XMPPRoom *)sender occupantDidUpdate:(XMPPJID *)occupantJID withPresence:(XMPPPresence *)presence {
  NSLog(@"%@ updated status with presence %@",[occupantJID full], presence.debugDescription);
 }

If i send default presence like unavailable type etc it works fine. 如果我发送默认状态,如不可用的类型等,它工作正常。 I referred XMPP definite book and other online docs but could not find any help. 我提到了XMPP定书和其他在线文档,但找不到任何帮助。

Now my understanding is the custom edited (added location attributes to the presence) presence is simply ignored by the room itself. 现在,我的理解是,房间本身只是简单地忽略了自定义编辑(向状态添加位置属性)状态。 MUC might be ignoring presence with other non-understandable elements. MUC可能会忽略其他不可理解元素的存在。 Is this my understanding correct? 我的理解正确吗?

I have a second question as: 我还有第二个问题:

The server component invites User2 to join User1 created room. 服务器组件邀请User2加入User1创建的会议室。 Once user2 joins the room, then after some time if any of the user1/user2 left the room then why the server_comp also gets a unavailable presence though the comp itself is not part of the room? 一旦user2加入会议室,那么一段时间后,如果user1 / user2中的任何一个离开会议室,那么为什么comp_本身不属于会议室,为什么server_comp也出现不可用的状态? Is it like because server_comp invites User2 on behalf of user1? 就像因为server_comp代表user1邀请User2吗?

I know I can't full reply to your questions but there are many things to talk about: I'm a java developer and I was also a iOS one, but I don't know xmpp for iOS. 我知道我无法完全回答您的问题,但是有很多事情要讨论:我是Java开发人员,也是iOS的开发人员,但我不知道适用于iOS的xmpp。

In general, there's no mechanism to validate any XML in OPENFIRE, so you can modify any XML as you want. 通常, 没有机制可以在OPENFIRE中验证任何XML ,因此您可以根据需要修改任何XML。 Since Openfire works with XML Pull Parser library, it's safe to add new attributes as LAST ONES. 由于Openfire与XML Pull Parser库一起使用,因此可以安全地将新属性添加为LAST ONES。

So if a message it's like 因此,如果有消息,就像

<message>
<body attr1="value1" attr2="value2">
</body>
</message>

add your custom tag in this way: 通过以下方式添加您的自定义标签:

<message>
<body attr1="value1" attr2="value2" customattr="customvalue">
</body>
</message>

because XMLPullParser works with positions of attributes, so if in Openfire code there will be a direct access to a position ( xml[1] ) you'll not destroy any functionality. 因为XMLPullParser可处理属性的位置,所以如果在Openfire代码中可以直接访问位置( xml[1] ),则不会破坏任何功能。 About tag order there's no problem, just don't wrap original root tag so as examples both will works: 关于标签顺序没有问题,只是不要包装原始的根标签,因此示例都可以:

<message>
<body attr1="value1" attr2="value2">
<customtagname xmlns="saffron.state:customaction"/>
</body>
</message>

<message>
<customtagname xmlns="saffron.state:customaction"/>
<body attr1="value1" attr2="value2">
</body>
</message>

However XMPP specs are really flexible as I know so there are some mechanism to add definied events and custom tags more or less in every Stanza (=Packet) that a client can intercept (in Smack API with a StanzaListener/Filter). 但是,据我所知,XMPP规范确实非常灵活,因此,存在某种机制可以在客户端可以拦截的每个Stanza(= Packet)中或多或少地添加定义事件和自定义标签(在具有StanzaListener / Filter的Smack API中)。

Most common elements are jabber:x:event ( spec ) 最常见的元素是jabber:x:event( spec

  <x xmlns="jabber:x:event">
    <offline/>
    <delivered/>
    <displayed/>
    <composing/>

but there is Extension Element mechanism that probably it's what are you looking for to add functionality (look here: specification ) 但是有扩展元素机制,可能正是您要添加功能的内容(请参见此处: Specification

More: presence passes mainly through Roster, but I think you are talking about groupchats. 更多:存在主要通过名册进行,但我认为您是在谈论小组聊天。 In groupchats there's a mechanism to ping user that seems transparent, the conference service has a param in minutes to kick an user that stay idle (default: 30, but there is also "never"). 在小组讨论中,有一种ping用户的机制看起来很透明,会议服务在几分钟之内就具有一个参数来踢闲置的用户(默认值:30,但也没有)。 Openfire offer this functionality in his web console (groupchats -> Groupchat settings -> select a conference service -> other settings). Openfire在他的Web控制台中提供了此功能(groupchats-> Groupchat设置->选择会议服务->其他设置)。

In groupchats it's not mandatory to ping the chat but you as developer can do it. 在小组讨论中,对聊天进行ping并不是强制性的,但是您作为开发人员可以做到。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM