Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increasing the timeout to prevent socket timeout error #90

Open
robinskumar73 opened this issue Mar 18, 2016 · 1 comment
Open

Increasing the timeout to prevent socket timeout error #90

robinskumar73 opened this issue Mar 18, 2016 · 1 comment

Comments

@robinskumar73
Copy link

I am facing socket timeout exception whenever I am trying to upload a little large image or some file through android. How can I increase timeout to prevent socket timeout exception?

@fvumbaca
Copy link

Hi @robinskumar73! I had the same problem.

The cleanest way I found to increase the timeout of the socket was to extend the com.strongloop.android.loopback.RestAdapter class and add the method:

public void setTimeout(int timeoutMillis) {
    getClient().setTimeout(timeoutMillis);
}

What i use is something like:

public class MyRestAdapter extends com.strongloop.android.loopback.RestAdapter{
    public static final int TIMEOUT = 30000;
    public MyRestAdapter(Context context, String url) {
        super(context, url);
        setTimeout(TIMEOUT); // Default to the desired timeout
    }
    // And the method above
}

And finally use this child class in place of the old RestAdapter class.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants