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

Support initial network time #10

Closed
francoischalifour opened this issue Aug 15, 2019 · 1 comment · Fixed by #27
Closed

Support initial network time #10

francoischalifour opened this issue Aug 15, 2019 · 1 comment · Fixed by #27
Labels
enhancement New feature or request

Comments

@francoischalifour
Copy link

francoischalifour commented Aug 15, 2019

When building apps, a challenging part is not getting a network response straight away. Responses often comes with random delays because network conditions are unstable. Getting responses from actual network conditions in development is an interesting feature because it would allow to design apps with high fidelity conditions: loading states, low-network resilience, flashes, etc.

This is a proposal to support initial network time.

Storing network time in the response

Right now, the response format contains:

  • Status code
  • Headers
  • Response

We could store some metadata in the cache, including the network time:

  • Status code
  • Headers
  • Response
  • Metadata
    • Network time

Here is the network information available in the Chrome Dev Tools Network panel:

Network panel

See explanation

Possible implementation

  1. Get this information from the network response
  2. Compute the time the network request took in the Node process (e.g. using Performance Timing API)

Bailing out of this feature

We can introduce a new option (e.g. skipDelays) that ignores the delays and returns the response straight away.

IMO network time should be respected by default.

@antoinechalifour
Copy link
Owner

This is indeed a very useful feature. We should be able to implement it easely after #11 is merged

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

Successfully merging a pull request may close this issue.

2 participants