i am developing chat application i want to send the recipient "is typing" when i type a message does any one has idea how to do this using xmpp framework and open fire as server.
below is my code
-(void)sendChatStateNotification: (NSString *)strState
{
NSXMLElement *message = [NSXMLElement elementWithName:@"message"];
NSXMLElement *chatStatus=[NSXMLElement elementWithName:strState xmlns:xmlns_chatstates];
[message addAttributeWithName:@"type" stringValue:@"chat"];
[message addAttributeWithName:@"to" stringValue:chatWithUser];
[message addChild:chatStatus];
}
-(void)textViewDidChange:(UITextView *)textView
{
[self sendChatStateNotification:@"composing"];
}
i am still not getting the notification
For sending Typing State
NSXMLElement *message = [NSXMLElement elementWithName:@"message"];
[message addAttributeWithName:@"type" stringValue:@"chat"];
[message addAttributeWithName:@"to" stringValue: toID];
NSXMLElement *composing = [NSXMLElement elementWithName:@"composing"];
[composing addAttributeWithName:@"xmlns" stringValue:@"http://jabber.org/protocol/chatstates"];
[message addChild:composing];
[xmppStream sendElement:message];
At Receiving Side
if ([message hasComposingChatState] == YES)
Check this condition and use it proper with your typing indication.
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.