Giter Site home page Giter Site logo

Comments (6)

cboden avatar cboden commented on August 19, 2024

This feature has been started in the underlying library reactphp-legacy/socket-client#10. Once it's implemented there it should be simple enough to add here.

from http-client.

clue avatar clue commented on August 19, 2024

πŸ‘ on supporting a timeout setting.

Though I'm not sure what the API could look like…
Also, when should we actually time out (connection timeout, whole request timeout, idle timeout etc…)?

I think it makes sense to add an API similar to reactphp-legacy/socket-client#10. Any thoughts on this @Renegade334?

from http-client.

Renegade334 avatar Renegade334 commented on August 19, 2024

Clients like cURL support both a connection timeout and a total timeout. Both would be useful, IMO, although I was originally thinking of total timeout when submitting this. The latter would be a client-level feature, I guess, whereas the former would be socket-level.

renegade@mercury:~$ curl --connect-timeout 1 http://10.255.255.1/
curl: (28) Connection timed out after 1001 milliseconds
renegade@mercury:~$ netcat -l 3456 &> /dev/null & curl --max-time 1 http://localhost:3456/
curl: (28) Operation timed out after 1000 milliseconds with 0 bytes received

from http-client.

WyriHaximus avatar WyriHaximus commented on August 19, 2024

@Renegade334 yes that makes sense. We could even go for 3 time outs:

  • Connect timeout, how long we wait for the connection to be created, done in socket-client
  • Response timeout, how long a server can take before responding
  • Response body timeout, how long it can take before the entire response body is downloaded

from http-client.

clue avatar clue commented on August 19, 2024

FWIW: This is likely related to #36. Possible implementation approach could be to just close() the request once the timeout timer fires.

from http-client.

clue avatar clue commented on August 19, 2024

I'm closing this as it is already supported by the new HTTP client that has been merged into react/http via reactphp/http#368 :shipit: You should upgrade as per #152 πŸ‘

from http-client.

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.