简体   繁体   中英

Chat app not working using XMPP protocol - open-fire server

Am using following code to send text to user using XMPP protocol configured with open-fire server.. i sent message to my app using spark IM client here i can receive the message but i cant send the text again in chat.

NSXMLElement *body = [NSXMLElement elementWithName:@"body"];
    [body setStringValue:msgContent];

    NSXMLElement *message = [NSXMLElement elementWithName:@"message"];
    [message addAttributeWithName:@"type" stringValue:@"chat"];
    [message addAttributeWithName:@"to" stringValue:@"nik@182.17.0.162"];
    [message addChild:body];
    NSLog(@"message: %@", message);
    [xmppStream sendElement:message];

this my code and my message structure is:

<message type="chat" to="nik@182.17.0.162"><body>rtytry</body></message>

my text is not posting to selected user.

Any suggestion ?.. am i doing anything wrong here..

Thanks

If I would guess: The IP in to= attribute is wrong. There should go the service name, which is often the domain of the xmpp server or in case of openfire: Whatever is configured as xmpp.domain server property.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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