Not logged in. · Lost password · Register
Forum: MatriX and XmppDotNet RSS
Avatar
wmorrison #1
Member since Dec 2015 · 50 posts · Location: Kingston, Jamaica
Group memberships: Members
Show profile · Link to this post
Subject: Ideas for Read Receipt
Hello,
 I am interested to find out if any has implement a read receipt for messages.  Having thought about it I have come up with the idea of using iqfilter and onIq event.  I have search the forum but nothing concrete was found.

Regards
Will
This post was edited on 2016-06-08, 01:43 by wmorrison.
Avatar
Alex #2
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
This was used a lot on the old XEP-0022 Message events using the displayed event.

See also XEP-0333: Chat Markers.

You can also very easy roll your own extension based on XEP-0184 Message Delivery Receipts.
Avatar
wmorrison #3
Member since Dec 2015 · 50 posts · Location: Kingston, Jamaica
Group memberships: Members
Show profile · Link to this post
Thanks Alex, the iqfilter worked very well.
Avatar
wmorrison #4
Member since Dec 2015 · 50 posts · Location: Kingston, Jamaica
Group memberships: Members
Show profile · Link to this post
Hi Alex,
    The IQfilter works once the users are both online.  However is one is not online, I am getting errors:
I am trying this:

  1. foreach (var message in unreadMessagesList)
  2. {
  3.     var msgReadIq = new MessageReadIq
  4.     {
  5.         Type = IqType.Get,
  6.         From = message.ToTelephoneNumber,
  7.         To = message.FromTelephoneNumber,
  8.         MessageRead = new MessageRead { ReadStatusDate = DateTime.Now.ToString(CultureInfo.CurrentCulture), MessageId = message.MessageXMPPId.ToString() }
  9.     };
  10.    
  11.     try
  12.     {
  13.         // Send the Stanza to the recipient via the server using IqFilter
  14.         _xmppClient.IqFilter.SendIq(msgReadIq, ReadResponse, "OPEN");
  15.  
  16.     }
  17.     catch (System.Exception ex)
  18.     {
  19.         var msg = ex;
  20.     }
  21. }

  1. <error code="503" type="cancel">
  2.     <service-unavailable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" />
  3. </error>

On the second time in the loop I am getting the error listed above.  Please note the recipient is offline.

Regards,
Will
This post was edited on 2016-06-24, 11:16 by Alex.
Avatar
Alex #5
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
You cannot send IQs to offline users. This is how XMPP is designed.
This is why the server resturns the error to you which is fine.

Offline users have no Resource which is required for IQs.

If you want to send information to a user while he/she is offline you have to use the message stanza, and send teh message to teh users Bare Jid.

Alex
This post was edited on 2016-06-24, 11:43 by Alex.
Avatar
wmorrison #6
Member since Dec 2015 · 50 posts · Location: Kingston, Jamaica
Group memberships: Members
Show profile · Link to this post
Hi Alex,
     After posting the question I did some reading and realized that this is how XMPP works.  So my read receipt implementation will have to be done using messges as well.  What is the different if I send the message to the users Full Jid as against the Bare Jid?  Also does matrix implement message events?

Regards,
Will
This post was edited on 2016-06-24, 15:49 by wmorrison.
Avatar
Alex #7
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
A user can be online with multiple client or devices at the same time. Each of those connections is specified by the unique resource.
If you want to send a message to a given client/connection/resource then you can do so by sending to the full Jid.
If you send to a bare Jid then the message get routed automatically to the "most available resource" or all resources. This depends on your server and its configuration.

Alex
Avatar
wmorrison #8
Member since Dec 2015 · 50 posts · Location: Kingston, Jamaica
Group memberships: Members
Show profile · Link to this post
Thanks for the information.  How does matrix handle message events?
Avatar
Alex #9
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
they just come in in the OnMessage handler like every other message to you.
Avatar
wmorrison #10
Member since Dec 2015 · 50 posts · Location: Kingston, Jamaica
Group memberships: Members
Show profile · Link to this post
Alex, I am not understanding what you are saying.  By the way we got our license today.  Thanks.
Avatar
Alex #11
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
I don't understand your last question, please elaborate.
Avatar
wmorrison #12
Member since Dec 2015 · 50 posts · Location: Kingston, Jamaica
Group memberships: Members
Show profile · Link to this post
In reply to post #9
Quote by Alex on 2016-06-24, 15:54:
1466776446

I am not understanding the above statement.  Could you elaborate please?
Avatar
Alex #13
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
you asked how MatriX handles Message Events.

XEP-0022: Message Events are sent within message stanzas. So if you receive a message event then MatriX just raises an OnMessage to you. The Message class has funtions to retrieve the message event.

Alex
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: