Wednesday, 15 July 2015

objective c - Network activity indicator and asynchronous sockets -



objective c - Network activity indicator and asynchronous sockets -

i have app continuously reads status updates server connection.

all working stream delegate handle reading , writing asynchronously.

there's no part of app "waiting" specific response server, continuously handling status updates sporadically arrive socket. there no requests on client side waiting responses.

i'm wondering best practice network activity indicator in case.

i turn on in stream event handler, , off before leave handler, short time (just plenty non-blocking read or write occur). trying this, see faintest flicker of indicator; needs on longer during event handler.

what turning on in stream delegate, , setting timer turn off short time later? (this ensure it's on long plenty seen, rather short time spent in stream delegate.)

note: i've tried lastly idea: turning on network activity indicator whenever there's stream activity, , note nsdate; in timer (that have fired every 1 second), if time passsed >.5 second, turn off indicator. seems give reasonable indication of network activity.

any improve recommendations?

if network activity continuous sounds might annoying user, if it's turning on , off time.

perhaps improve test lack-of-response timeout value , display alert view user if aren't getting response server. optional if can provide feedback (like "last update: 5 mins ago") user instead.

objective-c sockets networking nonblocking

No comments:

Post a Comment