1
votes

I am using openfire as chat server in my service. I need to notify user when interlocutor starts or stops typing message in chat.

I add custom message type notification_chat and send message with or extras without body:

When user starts typing:

<message id="SD4Vy-8" to="[email protected]" type="notification_chat"><composing xmlns="http://jabber.org/protocol/chatstates"/></message>

When user stops typing:

<message id="SD4Vy-9" to="[email protected]" type="notification_chat"><paused xmlns="http://jabber.org/protocol/chatstates"/></message>

But after send this packet openfire closes connection! In spite of this message delivered to recipient and I can process it by type and extras.

Why openfire kicks me is this case?

1

1 Answers

5
votes

you get kicked because you violate the XMPP specs. Adding new types to message is not allowed. You can only use the types defined in the RFC (normal, chat, groupchat, headline, error). When you need custom information then add your own tags in your own namespace to message.

example:

<message>
   <x xmlns="http://www.mycompany.com/extension1">
     <messagetype>notification_chat</messagetype>
   </x>
</message>