I am working on a chat application where I set my xmppHostName- 'myserver' and server port -5222. First I created a user on xmpp through my application and it got registered on xmpp but there was an authentication error (although my user id and password were both same). Then I solved this authentication issue by using following method-
NSError *authenticateError = nil;
XMPPPlainAuthentication *plainAuth = [[XMPPPlainAuthentication alloc] initWithStream:self.xmppStream password:password];
if (![_xmppStream authenticate:plainAuth error:&authenticateError]) {
NSLog(@"Authentication errorrrr: %@", authenticateError.localizedDescription);
}
and the authentication error is gone, and my user is online but when I try to send any messages, the server replies with an error through otherserver:
<message xmlns="jabber:client" id="ACC2AAA6-42CE-4590-95A0-C4B28BE9BF04" to="97@otherserver/4ywme5xjh0" from="62@myserver" type="error"><error code="404" type="cancel"><remote-server-not-found xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/></error></message>
where, 97 is my user id and 62 is front users id. Below is my code for sending xmpp message:
NSXMLElement *body = [NSXMLElement elementWithName:@"body"];
[body setStringValue:messageBody];
NSXMLElement *subject = [NSXMLElement elementWithName:@"subject"];
[subject setStringValue:subjectName];
[message addAttributeWithName:@"to" stringValue:[user stringByAppendingString:myserver]];
[message addChild:body];
[message addChild:subject];
[self.xmppStream sendElement:message];
Here, 'myserver' is my server's hostname and the server replies from another server 'otherserver'. I am sure that I am not setting this 'otherserver' anywhere in my application, then how is this possible that it replies through it?