XMPPStreamManagement receive message acknowledgement from server

I am using XMPPFramework for iOS and have ejabberd as XMPP Server. I want to receive acknowledgement for a message i send to the server.

XMPPStream *xmppS = [[XMPPStream alloc] init];
[xmppS addDelegate:self delegateQueue:dispatch_get_main_queue()];

XMPPStreamManagement  *xsm = [[XMPPStreamManagement alloc] init];
[xsm addDelegate:self delegateQueue:dispatch_get_main_queue()];
[xsm activate:xmppS];

NSXMLElement *a = [NSXMLElement elementWithName:@"request" xmlns:@"urn:xmpp:receipts"];
XMPPElement *e = [[XMPPElement alloc] initWithName:@"message"];
[e addAttributeWithName:@"id" stringValue:@"123456"];
[e addAttributeWithName:@"type" stringValue:@"chat"];
[e addAttributeWithName:@"to" stringValue:@"testuser@myxmppserver.com"];
[e addAttributeWithName:@"from" stringValue:@"testuser2@myxmppserver.com"];
[e addChild:a];
[xsm.xmppStream sendElement:e];

The message is successfully received by the recipient but how can i know if the server has received the message?

XMPPStreamManagement receive

Which XMPP extension are you referring to ?

If you are referring to XEP-0184: Message Delivery Receipts, the way I understand it is that this is the receiving client that is intended to send the ack when the message is received, not the server:

This specification defines an XMPP protocol extension for message delivery receipts, whereby the sender of a message can request notification that the message has been delivered to a client controlled by the intended recipient.

XMPPStreamManagement receive

I am referring to XEP-0198.

I have successfully implemented XEP-0184.

XMPPStreamManagement receive

"a" element in XEP-0198 is not a child of message.

XMPPStreamManagement receive

then how should i go about implementing this? if you could share some code or a link where i can read about it.

Thanks

XMPPStreamManagement receive

The best source to know how XEP-0198 works is to read the XEP it itself.

It is available from XMPP.org website: XEP-0198

Please read especially, the part of basic acking scenario: 8.1 Basic Acking Scenario

thanks for sharing the

thanks for sharing the link.

it says i should send an <enable/> element and the server will reply with <enabled/> element.

i am sending the element but i don't know where to check if the server is replying with <enabled/> element or not

The best way to try XMPP

The best way to try XMPP features is to test at the low level. You can use Psi or Psi+ and switch to debug console to send the needed packet and see what the server replies.

This is very handy for learning, testing and developing.

have been using Psi+ for a

have been using Psi+ for a few days now and i must say its a great way to learn and test how the server works. i can now enable stream management on my server

Thanks

You are welcome :)

You are welcome :)

hi all, i am also developing

hi all,
i am also developing iOS chat application and want to use XMPPStreamManagement.

i use following code for enable XMPPStreamManagement,

xmppStream = [[XMPPStream alloc] init];
[xmppStream supportsPush];
[xmppStream supportsRebind];
xmppStream.hostName = [NSString stringWithFormat:@"%@",XMPPSERVICE_URL];
xmppStream.hostPort = 5222;
xmppStream.keepAliveInterval = 600;
xmppStream.enableBackgroundingOnSocket = YES;
[xmppStream addDelegate:self delegateQueue:dispatch_get_main_queue()];

and for Stream management
xmppStremManage = [[XMPPStreamManagement alloc] initWithStorage:[XMPPStreamManagementMemoryStorage new]];
xmppStremManage.autoResume = YES;
[xmppStremManage enableStreamManagementWithResumption:TRUE maxTimeout:100000];
[xmppStremManage activate:xmppStream];
[xmppStremManage addDelegate:self delegateQueue:dispatch_get_main_queue()];

but the delegate methods regarding Stream management not call.
i.e
-(void)xmppStreamManagement:(XMPPStreamManagement *)sender wasEnabled:(DDXMLElement *)enabled
or
- (void)xmppStreamManagement:(XMPPStreamManagement *)sender wasNotEnabled:(NSXMLElement *)failed

can any one help me on this issue.

Use psi as debugger and go

Use psi as debugger and go through xml console to find if you have successfully enabled stream management .

Syndicate content