Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to limit speed and response time in Node (Express)?

I would like to see how my website reacts to a slow connection.

Is there a way I can limit express to responding with slow speeds or delays? I know I can implement setTimeout calls on paths, but what about static assets?

like image 374
lonewarrior556 Avatar asked Dec 18 '22 14:12

lonewarrior556


1 Answers

As I've mentioned in the comments, modern browsers support network speed simulation (and much more). Doing any programatic latency faking within your app is not a good approach because network simulation is difficult, it's hard to do it reliably and you could end up polluting your code a lot.

You should use a browser to do this:

  • Chrome (best support)
  • Firefox
  • Edge (not yet supported but it has been suggested)

There are also many other tools and resources you can use:

  • crapify (NodeJS)
  • How to simulate slow connection on a Mac
  • Fiddler
  • and many more...
like image 73
nem035 Avatar answered Jan 26 '23 00:01

nem035