How to handle navigation error on API calls

47 views
Skip to first unread message

Prabu Duraiswamy

unread,
Oct 6, 2012, 8:34:03 AM10/6/12
to rhom...@googlegroups.com
Hi,

I would like to handle set a timeout problem in REST API calls.

1. if the internet connection is not available I want to through error message like "no network available" and 
2. suppose network is slow want to show error message like "connection problem" and 
3. how can I determine the response time taken by API call. Is there a way to get the response time taken in Rho AsyncHttp method?

Thanks in advance
Prabu D

Jon Tara

unread,
Oct 6, 2012, 12:39:04 PM10/6/12
to rhom...@googlegroups.com
Just use the Ruby Time class. Save the current time when you make the call, and subtract from the time when you get the callback.

Prabu Duraiswamy

unread,
Oct 11, 2012, 3:50:22 AM10/11/12
to rhom...@googlegroups.com
Thanks Jon Tara. But how can I handle Navigation Time out error ? Its appear on mobile screen when page load with API request / response takes some delay. 

On Sat, Oct 6, 2012 at 10:09 PM, Jon Tara <jtara-g...@spamex.com> wrote:
Just use the Ruby Time class. Save the current time when you make the call, and subtract from the time when you get the callback.

--
You received this message because you are subscribed to the Google Groups "rhomobile" group.
To view this discussion on the web visit https://groups.google.com/d/msg/rhomobile/-/X8plRR5fyG8J.

To post to this group, send email to rhom...@googlegroups.com.
To unsubscribe from this group, send email to rhomobile+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rhomobile?hl=en.



--
Thank You.


Regards,
Prabu D

Jon Tara

unread,
Oct 11, 2012, 11:15:34 AM10/11/12
to rhom...@googlegroups.com
That's not what you asked. You asked how to measure the response time of REST API calls. I told you how to measure the response time.

It sounds like you are using a blocking call to AsyncHttp. Your controller is making a call and waiting for the result. If you make a blocking call and the server doesn't respond quickly enough, of course your page request is going to time-out.

Don't use a blocking call. Use callbacks.

I wish the docs would not encourage people to make blocking calls to AsyncHttp in controllers. It is a naive approach that is never going to make users happy.

Prabu Duraiswamy

unread,
Oct 12, 2012, 6:38:59 AM10/12/12
to rhom...@googlegroups.com
Yes you are correct, right now I am using blocking calls,will use callbacks instead.

-- 
Thank You.


Regards,
Prabu D

--
You received this message because you are subscribed to the Google Groups "rhomobile" group.
To view this discussion on the web visit https://groups.google.com/d/msg/rhomobile/-/DhS1zNbMeXoJ.
Reply all
Reply to author
Forward
0 new messages