Vanjo
Hi all!!
This is my second time here in the forum. Thanks for your help last time!! but now I have some other issue.
I am trying next;
I am running in my view controller a table which contains items, when I choose one of them, I call a popOver in a different view controller, which is a kind of detail about items. So when I pressed button, I raise my popover and I want to stop or unsubscribe table. Actually I haven't able to do it yet, so I have to put 2 buttons, just for being testing. After that I found for any unknown reason the method subscribe and unsubscribe specifically in this part:
- (void) subscribeItems
{
more stuffs!!!!
......
......
_tableKey= [_client subscribeTableWithExtendedInfo:tableInfo delegate:self useCommandLogic:NO]
}
- (void) unsubscribeItems
{
more stuffs!!!!
......
......
[_client unsubscribeTable:_tableKey];
}
It took a lot of time to do it and in mean time the app is freeze.
Have you ever seen a behavior like this? Could you try to explain me what is happening here?
Thanks a lot!!
gianluca.bertani
Hello,
both these calls wait until the subscription/unsubscription has been completed on the server. If they are run in a situation of poor connectivity, they can freeze the thread until the network times out. A simple workaround is to move this calls to a background thread.
Best regards,
Gianluca
Vanjo
Hi Gianluca!!
I am pretty sure those methods wait until they are completed but how long should I wait? 1, 5, 30 seconds, more than 1 minute?. Even if I have a low connection, how much bandwidth do I need for an optimal functionallity? just for having in mind.
Also you mentioned me something about "constraints" and I was using it because I wanted to limit bandwith. Now I have removed those lines about constraints for recheck and see what happening now but nothing relevant happened, I mean, it keeps wasting time subscribing/unsubscribing it.
I am going to check how implement those methods on background.
Thanks for your time!!
Regards
gianluca.bertani
Consider that iOS may take a very long time before timing out, you could wait minutes. This is a common problem on iOS, in no way due to Lightstreamer.
Consider also that the client library is able to handle disconnections and reconnections automatically, it monitors the status of network connectivity and reconnects only when the system says the network is there (library version 1.1 and above, use always the latest version compatible with your server). It will also automatically resubscribe your items once the connection has been re-established.
Unless you have very specific issues, you should let the library handle this problems and limit your code to subscribe and unsubscribe when needed. Of course, as we discussed in previous messages, subscribe only what you need to show, to keep bandwidth to a minimum.
Best regards,
Gianluca