0

I am building an iOS app to integrate with Facebook Chat using XMPP (I am using the XMPPFramework library). It works fine when I am testing myself with 2 iPhones but when I asked my beta users (around 5 in total) to test it simultaneously, I encountered two connection issues:

  1. When my app tried to open a connection to chat.facebook.com, it occasionally received a "connection refused" error.
  2. Even though a connection was made successfully, it dropped after a short period (less than a minute) with an error "Socket closed by remote peer".

As I said it works fine when I am just testing it with myself with 2 iPhones so all permission setup should be correct. I am wondering if Facebook has placed any simultaneous limit on number of chat connections for an app or if I have missed anything.

Any help is greatly appreciated.

Ivan
  • 10,052
  • 12
  • 47
  • 78
Billy Kan
  • 110
  • 1
  • 8

1 Answers1

0

Since you are using XMPPFramework, the XMPPReconnect module should do it: it simply restores the connection when the server drops it down (like the Facebook chat server seems to do).

#import "XMPPReconnect.h"

// [...]

XMPPReconnect *reconnect = [[XMPPReconnect alloc] initWithDispatchQueue:dispatch_get_main_queue()];
[reconnect activate:yourXMPPStream];

Be sure to store the reconnect object somewhere to avoid dealloc.

Michele De Pascalis
  • 932
  • 2
  • 9
  • 26
  • Thanks and yes I have used XMPPReconnect so it's auto recovered. Still it's a nuisance to have disconnection every minute. Anyway, it only only happens on that day and did not happen again - so I assume it's a facebook issue. – Billy Kan Mar 01 '13 at 07:29