Not logged in. · Lost password · Register
Forum: MatriX RSS
Avatar
mrbelk #1
Member since Feb 2017 · 23 posts
Group memberships: Members
Show profile · Link to this post
Subject: Matrix client not receiving presence updates from OpenFire
My company has built a system using XMPP for inter-device messaging using OpenFire, Matrix for Android, and Smack (for a straight Java app). The system architecture has a set of "remote" devices (running an app built in Android Studio using the Smack XMPP SDK) all updating their presence periodically in response to environmental changes. Listening for those presence updates are various "monitor" devices build with Xamarin.Android and using the Matrix SDK. In some environments, we're seeing that the monitor devices are not getting the presence updates from the remotes. The OpenFire "sessions" list shows the correct current presence of all of the connected devices, but the devices using the Matrix SDK don't show any presence stanzas coming over the wire when we hook up the OnSendXml and OnReceiveXml events and emit the XML to the android log. In one case, the presence updates of one connected "remote" continued uninterrupted, and the rest were silent. That leads me to point to the XMPP server, but I can't be for sure.

We never get any sort of Matrix connection error when this happens, we just quit getting the XML.

We are trying to isolate which component might be the culprit, but we can only reproduce this behavior in some environments but not all (like our office). We are in the process of attaching other, generic XMPP clients to the system to watch the XML log, but since we cannot reproduce in our office, we have to wait for our client to perform this task and wait for things to hang up.

Is there anything else we should be looking for?

Thanks,
Matthew
Avatar
mrbelk #2
Member since Feb 2017 · 23 posts
Group memberships: Members
Show profile · Link to this post
OK. Some more context...

When we run the Adium client and enable the XML log, I see these messages:

  1. <iq xmlns='jabber:client' type='get' id='241-295' from='webtest.bizspeed.corp' to='plsadmin@webtest.bizspeed.corp/MBELK-MBP'>
  2.     <ping xmlns='urn:xmpp:ping'/>
  3. </iq>
  4.  
  5. <iq type='result' to='webtest.bizspeed.corp' id='241-295'/>

In the the android log from one of the "monitor" devices, I see no such entries from the XMPP Ping messages being sent from the OpenFire server. Should I see those emitted if I am handling both the OnSendXml and OnReceiveXml events?

-MrB
This post was edited on 2017-07-10, 19:07 by Alex.
Avatar
mrbelk #3
Member since Feb 2017 · 23 posts
Group memberships: Members
Show profile · Link to this post
Some more...

When I changed the XMPPClient properties in my monitor app code to explicitly set the value of the "AutoReplyToPing" property to true (which I thought was the default), then I get the two stanzas.
Avatar
Alex #4
Member since Feb 2003 · 4296 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
yes you should reply to Pings, if you don"t the server usually assumes that your client is dead and kills the connection.
MatriX can do this automatically for you when you set AutoReplyToPing to true.

Also check on Android if your App is allowed to run in background and connected. When its not allowed to keep the socket alive in the background, then the OS kills your connection, but you should get the OnClose event then.
Also mobile networks can be very unreliable, but also in this case you should get an OnClose event sooner or later from MatriX.

Alex
Avatar
mrbelk #5
Member since Feb 2017 · 23 posts
Group memberships: Members
Show profile · Link to this post
Thanks for the response, Alex.

We're only WiFi in this system, so no issues with potential cellular network problems. I'll check the android app settings/permissions, but these devices run our apps basically as kiosks, with no other apps in the foreground. I am handling the OnClose and OnError events and those eventhandlers are not being invoked when this happens (I log those events to the android log).

-MrB
Avatar
Alex #6
Member since Feb 2003 · 4296 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Okay.

try to reply to Pings. And also try to send your own Pings to teh server every X minutes.
Some routers kill connections when they see no active traffic for a while, which can happen on XMPP sessions.

Other than this I have no idea right now. Adding more logging for all available MatriX events may help to find issues.

Alex
Avatar
mrbelk #7
Member since Feb 2017 · 23 posts
Group memberships: Members
Show profile · Link to this post
I did change the client properties to set AutoReplyToPing to true.

How would I go about sending my own Ping packets?

Thanks,

-MrB
Avatar
Alex #8
Member since Feb 2003 · 4296 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
see here:
https://forum.ag-software.net/thread/1173-Application-hang…

you can send this with the IqFilter class and wait for a reply.

Alex
Avatar
mrbelk #9
Member since Feb 2017 · 23 posts
Group memberships: Members
Show profile · Link to this post
We're now pretty sure this is an "OpenFire" issue since we're seeing similar behavior using "generic" XMPP chat apps like Adium or Spark.
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