onExtensionResponse stops firing

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

Moderators: Lapo, Bax

nmikros
Posts: 3
Joined: 21 Jun 2013, 23:43

onExtensionResponse stops firing

Postby nmikros » 26 Jun 2013, 19:10

On some iPads the game seems to stop calling "onExtensionResponse" but we know that the message is coming in because we are printing the stream in "onDebugMessage". We took out a message with an empty parameter and that seems to help but is that a known issue? Should we be passing null? We are also adding the param to a queue comprised of an NSMutableArray and NSmutableDictionary, could that be causing problems?
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: onExtensionResponse stops firing

Postby Lapo » 27 Jun 2013, 07:26

We took out a message with an empty parameter and that seems to help but is that a known issue? Should we be passing null?

What do you mean by message with an empty parameter? And what else could it be if not null?
I mean the only way in which you can send a key in an SFSObject without any values is to use the NULL type.
Can you clarify?

We are also adding the param to a queue comprised of an NSMutableArray and NSmutableDictionary, could that be causing problems?

This is also not clear.
What is the param? Are we talking about the Extension SFSObject or something else?
Lapo
--
gotoAndPlay()
...addicted to flash games
nmikros
Posts: 3
Joined: 21 Jun 2013, 23:43

Re: onExtensionResponse stops firing

Postby nmikros » 27 Jun 2013, 17:53

Hi Lapo,
Sorry didn't mean to be unclear. On the server side we are sending it off like this:


Code: Select all

 ISFSObject respObj = new SFSObject();
            mMainServer.send("MSG_ARE_YOU_STILL_HERE", respObj, mGameRoom.getUserList());

instead of

Code: Select all

mMainServer.send("MSG_ARE_YOU_STILL_HERE", null, mGameRoom.getUserList());


and on the client side we are doing this:

Code: Select all

-(void)onExtensionResponse:(SFSEvent *)evt
{
    NSString *cmd = [evt.params objectForKey:@"cmd"];
   
    SFSObject *params = [evt.params objectForKey:@"params"];
   
   if(cmd && params)
    {
       if([cmd isEqualToString:MSG_MONTAGE])
        {
            MontageMessage * obj = [[[MontageMessage alloc] initWithSFSObject:params] autorelease];
            [[PostOffice Single] Broadcast:cmd withParam:obj];
        }
        else
        {
            [[PostOffice Single] Broadcast:cmd withParam:params];
        }
   }
   
}



where PostOffice is storing the params in like this:

Code: Select all

-(void) Broadcast:(NSString*)msg withParam:(id)param
{
    @synchronized(_mQueue)
    {
        NSArray * broadcastItem = [NSArray arrayWithObjects:[NSString stringWithFormat:@"%@",msg], param,nil];
        [_mQueue addObject:broadcastItem];
    }
}


where _mQueue is a NSMutableArray (it's later processed in an Update loop).
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: onExtensionResponse stops firing

Postby Lapo » 27 Jun 2013, 18:52

If you don't need to send any extra parameter from server side just pass a new SFSObject() . Null may cause problems to the client, although Objective-C is resilient to null pointers.

Thanks
Lapo

--

gotoAndPlay()

...addicted to flash games
nmikros
Posts: 3
Joined: 21 Jun 2013, 23:43

Re: onExtensionResponse stops firing

Postby nmikros » 27 Jun 2013, 22:25

I see, but that's what we are doing. When we remove that message the game is way more stable.
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: onExtensionResponse stops firing

Postby Lapo » 28 Jun 2013, 08:42

You're probably sending too many messages per second. What is the frequency?
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 28 guests