Giter VIP home page Giter VIP logo

Comments (8)

mattbdean avatar mattbdean commented on August 11, 2024

Have you tried RestClient.setTimeoutLength()?

from jraw.

janpetryk avatar janpetryk commented on August 11, 2024

This method sets only connection timeout length, not read timeout which I was talking about.

from jraw.

mattbdean avatar mattbdean commented on August 11, 2024

I think it would be a good idea to remove/deprecate setTimeoutLength() and provide a getOkHttpClient() method, which would allow you to configure the client directly. How do you feel about that?

from jraw.

janpetryk avatar janpetryk commented on August 11, 2024

It is fine by me. The question is how tightly do you want to couple your project with okhttp client.

from jraw.

mattbdean avatar mattbdean commented on August 11, 2024

In the next release you should be able to adjust the read timeout using reddit.getHttpAdapter().setReadTimeout(int).

from jraw.

ZacSweers avatar ZacSweers commented on August 11, 2024

What happened to getOkHttpClient()? With the new interceptors features, it would be great to be able to take advantage of that. A good use case would be with Facebook's new Stetho library, which plugs into it with its own interceptor: https://github.com/facebook/stetho

A good middleground would be to maybe expose this as part of HttpAdapter, but not sure if you want that to have anything specific to OkHttp.

from jraw.

mattbdean avatar mattbdean commented on August 11, 2024

getOkHttpClient() was removed in favor of getHttpAdapter() as it decouples JRAW from any specific HTTP library. The default implementation of HttpAdapter (OkHttpAdapter) still uses OkHttp, but the the interface is written in such a way that HttpAdapters could be made for HttpComponents or some other library without an API change.

If you wanted to bring a method like getOkHttpClient() back, I would suggest introducing generics to HttpAdapter:

public interface HttpAdapter<T> {
    // <other methods here>
    public T getNativeClient();
}

So then HttpAdapter could be declared like this:

public class OkHttpAdapter extends HttpAdapter<OkHttpClient>

from jraw.

ZacSweers avatar ZacSweers commented on August 11, 2024

That seems reasonable to me. Would you be open to a pull request for that?

from jraw.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.