3

why I am getting this error when try to send message in a group created in xmpp muc.

this is message packet that I am receiving

<message xmlns="jabber:client" from="testgrp@conference.localhost" to="7023651847@localhost/787052459360862999820058" type="error"><body>hiiii</body><error code="406" type="modify"><not-acceptable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"></not-acceptable><text xmlns="urn:ietf:params:xml:ns:xmpp-stanzas">Only occupants are allowed to send messages to the conference</text></error></message>

error text : Only occupants are allowed to send messages to the conference

method that I am using to create group is : XMPPFramework - How to create a MUC room and invite users?

Community
  • 1
  • 1
Sandeep Jangir
  • 412
  • 5
  • 14

1 Answers1

3

The error message seems self explanatory: You are not an occupant (as define in XEP-0045 = you did not join the room) and as such you cannot send messages.

You can check role privileges in XEP-0045 for reference: http://xmpp.org/extensions/xep-0045.html#roles-priv

Only participants can send messages to all.

Mickaël Rémond
  • 9,035
  • 1
  • 24
  • 44
  • 1
    You are right but this does not happen when I join the room and chat first time, after closing my client ios app and restart the app then if I send the messages it shows this error. Well this is the actual problem – Sandeep Jangir Jun 24 '16 at 12:07
  • 2
    When you join you are an occupant. When you close the app, client is sending presence offline, including to the MUC and your are not occupant anymore. That mean you need to join again on login if you want to be an occupant again and be allowed to send message. That behaviour is well defined in XEP-0045. – Mickaël Rémond Jun 25 '16 at 15:16
  • @MickaëlRémond Can you please check code that anything goes wrong? let roomStorage = XMPPRoomCoreDataStorage.sharedInstance() let roomJid = XMPPJID.init(string: "\(groupName)@conference.\(constantVar.hostUrl)") let xmppRoom = XMPPRoom.init(roomStorage: roomStorage, jid: roomJid, dispatchQueue: DispatchQueue.main) as XMPPRoom xmppRoom.activate(self.xmppStream) xmppRoom.addDelegate(self, delegateQueue: DispatchQueue.main) xmppRoom.join(usingNickname: self.xmppStream.myJID.bare(), history: nil, password: nil) – Dipang Sep 11 '17 at 09:56