Not logged in. · Lost password · Register
Forum: MatriX RSS
Need a callback mechanism triggered when sending the xmpp message is either succeeded or failed.
Avatar
AlexeyE #1
Member since Oct 2015 · 2 posts
Group memberships: Members
Show profile · Link to this post
Subject: Asynchronous Send method.
Hi,

I need a way to register a callback to be invoked when sending the message is either succeeded or failed.
The messages we are sending are created in a transaction, and it is important to roll the transaction back when sending is failed.
Is there a way I could currently establish this? Having SendAsync methods in the client API would be the most obvious way to deal with such scenarios.
Avatar
Alex #2
Member since Feb 2003 · 4322 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
There are many different ways of doing this. It depends on your use case which one will be the best.

Here are some solutions:

1) Use OnStanzaSent event as callback in MatriX. This only tells you that the packe left the socket in MatriX without any errors. But the delivery can still fail someone on the network, on the server, or the receiver while processing.

2) Use Acks from XEP-0198: Stream Management. This is implemented with SendAndAck in MatriX when your server supports it.

3) XEP-0184: Message Delivery Receipts which is end to end

4) use IQs instead of message, which always give you a result. Callback can be defined with the IqFilter in Matrix

5) build your own custom extensions based on IQs.

To me transactions sound like a perfect use case IQs instead of messages.

Alex
Avatar
AlexeyE #3
Member since Oct 2015 · 2 posts
Group memberships: Members
Show profile · Link to this post
Thank you very much for the quick response!

Alexey
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Forum: MatriX RSS