Subject: Can't receive messages after disconnecting from internet
Hello, here is my scenario.
I have two cell phones that are running a chat app that have Matrix XMPP. When both phones are connected to the internet, everything works fine. But here is the problem I found:
1) Turn off Phone A's internet connection
2) Send message from Phone B to Phone A
3) Turn on Phone A's internet connection
However, the message sent from Phone B is not received on Phone A after it is reconnected to the internet. Although I can send messages between the two phones normally again.
My app is built using C#. I have an event handler that is triggered when the device's internet connection turns on or off. I notice that when I turn the internet off, the event handler is triggered, however it still says that the XMPPClient.StreamActive = true.
Then if I wait about 10 or 15 seconds (with the internet connection still turned off), I get these messages from the OnError event:
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
and sometimes:
An existing connection was forcibly closed by the remote host.
So, I am wondering what the best way to handle this is. After the internet is disconnected, should I call XMPPClient.Close()? And when it is reconnected, should I call XMPPClient.Resume() or XMPPClient.Open()?
Like I said, right now I am using a different event handler to check on the connection status; should I only rely on XMPP's events to check for internet status?
I have two cell phones that are running a chat app that have Matrix XMPP. When both phones are connected to the internet, everything works fine. But here is the problem I found:
1) Turn off Phone A's internet connection
2) Send message from Phone B to Phone A
3) Turn on Phone A's internet connection
However, the message sent from Phone B is not received on Phone A after it is reconnected to the internet. Although I can send messages between the two phones normally again.
My app is built using C#. I have an event handler that is triggered when the device's internet connection turns on or off. I notice that when I turn the internet off, the event handler is triggered, however it still says that the XMPPClient.StreamActive = true.
Then if I wait about 10 or 15 seconds (with the internet connection still turned off), I get these messages from the OnError event:
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
and sometimes:
An existing connection was forcibly closed by the remote host.
So, I am wondering what the best way to handle this is. After the internet is disconnected, should I call XMPPClient.Close()? And when it is reconnected, should I call XMPPClient.Resume() or XMPPClient.Open()?
Like I said, right now I am using a different event handler to check on the connection status; should I only rely on XMPP's events to check for internet status?