1
votes

I am developing chat application using XMPP. Here my problem is, I want to send chat notifications .I tried the fallowing way but not getting correctly.

- (void)sendMessage:(id)sender
{   


    NSString *messageStr =messageField.text;
    if([messageStr length] > 0)
    {

         NSXMLElement *body = [NSXMLElement elementWithName:@"body"];
         NSXMLElement *chatStatus=[NSXMLElement elementWithName:@"composing" xmlns:xmlns_chatstates];

        [body setStringValue:messageStr];
         NSXMLElement *message = [NSXMLElement elementWithName:@"message"];
        [message addAttributeWithName:@"type" stringValue:@"chat"];
        [message addAttributeWithName:@"to" stringValue:jidString];

        [message addChild:chatStatus];
        [message addChild:body];


        [[self xmppStream] sendElement:message];
    }
}

I am using above method for sending a message.But it always shows typing notification even i am not typing .can any one help to me. thanks in advance

1

1 Answers

4
votes

According to XEP-0085: Chat State Notifications, you should send another notification saying you've stopped typing, for example <active/> or <paused/>.