[BUG][iOS1.3.7] SmartFox2XClient isConnected not updated

Post here your questions about the Objective-C API for SFS2X

Moderators: Lapo, Bax

Zammy
Posts: 29
Joined: 05 Aug 2014, 16:37

[BUG][iOS1.3.7] SmartFox2XClient isConnected not updated

Postby Zammy » 05 Dec 2014, 16:03

SmartFox2XClient object returns isConnected == YES at the moment of the event "disconnect".

This happens after I have waited the "userReconnectionSeconds" time to test my logic.

I tried to dispatch the check with 2 seconds delay. It still returns YES.
mack
Posts: 8
Joined: 25 Feb 2015, 11:25

Re: [BUG][iOS1.3.7] SmartFox2XClient isConnected not updated

Postby mack » 25 Feb 2015, 12:04

I am experiencing same issue.

I am receiving onConnectionLost event (event.type = 'disconnect' instead of 'connectionLost') and propagate it to checkConnectionEstablished method.
In checkConnectionEstablished I use isConnected from SmartFox2XClient and get YES.

Any updates or simple work-arounds?
User avatar
Lapo
Site Admin
Posts: 22999
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: [BUG][iOS1.3.7] SmartFox2XClient isConnected not updated

Postby Lapo » 25 Feb 2015, 15:15

Hi,
we're currently working on a number of fixes/additions which will include this as well.

I am not sure about event.type problem. Normally you just need to add the <ISFSEvents> protocol to your event listener class, then implement the relevant event methods. Eg: onConnection, onConnectionLost etc...

A simple workaround is to set your own "connected" flag when the connection event is triggered.

Moreover if you are dispatching a disconnection event to some other methods it is expected that the isConnected method will always report NO. This is to say that checking such flag is redundant when you are delegating the disconnection event.

Make sense?
Lapo
--
gotoAndPlay()
...addicted to flash games
mack
Posts: 8
Joined: 25 Feb 2015, 11:25

Re: [BUG][iOS1.3.7] SmartFox2XClient isConnected not updated

Postby mack » 26 Feb 2015, 14:39

Hi,

Thank you for the answer.
Yes, it makes sense.

The bug with event types is reported here: viewtopic.php?f=21&t=17509
I also found, when I use Android SDK I can catch handshake event (it comes in dispatchEvent method), and there are no such an event in iOS SDK (onConnectionHandshake ?).

Back to the topic, we ended up with wrapping our own "connected" flag.

We are dispatching appearance of a disconnection event to the checkConnectionEstablished, but actually not the value of connection status. checkConnectionEstablished is separated and gets the status from "connected" flag. We also had to use killConnection to let the retrying mechanism connect again.
User avatar
Lapo
Site Admin
Posts: 22999
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: [BUG][iOS1.3.7] SmartFox2XClient isConnected not updated

Postby Lapo » 26 Feb 2015, 14:51

mack wrote:Hi,
The bug with event types is reported here: viewtopic.php?f=21&t=17509
I also found, when I use Android SDK I can catch handshake event (it comes in dispatchEvent method), and there are no such an event in iOS SDK (onConnectionHandshake ?).

You can catch the handshake event, but it's undocumented and not useful to the developer.


We are dispatching appearance of a disconnection event to the checkConnectionEstablished, but actually not the value of connection status. checkConnectionEstablished is separated and gets the status from "connected" flag. We also had to use killConnection to let the retrying mechanism connect again.

[/quote]
I see. However when you dispatch a disconnection event there is no point in checking the status of the connection, because you just got disconnected.
If you are using the reconnection system, the disconnection event will fire if and only if the reconnection failed.

thanks
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SFS2X iPhone / iPad / OSX API”

Who is online

Users browsing this forum: No registered users and 6 guests