I am working on a chat application to achieve multiuser chat functionality. I am able to join room and send message but i am facing a strange problem. While sending message to room, message repeat/duplicate itself. This issue is in sender side (user who is sending message to room) while other users in room are getting one message which is correct.
- (void)sendMessageWithBody:(NSString )messageBody andMessageId:(NSString) messageId
{
if ([messageBody length] == 0) return;
NSXMLElement *body = [NSXMLElement elementWithName:@"body" stringValue:messageBody];
XMPPMessage *message = [XMPPMessage message];
[message addAttributeWithName:@"id" stringValue:messageId];
[message addChild:body];
[self sendMessage:message];
}