[英]how to send typing notification using xmpp openfire
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. 我正在开发聊天应用程序我想发送收件人“正在打字”当我输入消息时,任何人都知道如何使用xmpp框架和打开火作为服务器。
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. 检查此情况并使用正确的打字指示。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.