Another solution to excessive JS calls could be to simply add a caching layer that stores whatever the JS callback wrote, for a duration of X seconds, seding it back from cache until next update.
This could be entirely separate, as a wrapper of SSLApp / App like CachingApp, CachingSSLApp. Like a proxy but built-in.
It could be good for benchmarks while not having to change existing code. It also makes it possible to build real world examples like "what's the price of gold" being updated every 30 seconds, hitting the cache all other times.
Alternatively the API could be that you just add an integer after the handler, for how many seconds the cache is valid, defaulting to 0. Then you could mix cached endpoints with non-cached ones seamlessly.
Another solution to excessive JS calls could be to simply add a caching layer that stores whatever the JS callback wrote, for a duration of X seconds, seding it back from cache until next update.
This could be entirely separate, as a wrapper of SSLApp / App like CachingApp, CachingSSLApp. Like a proxy but built-in.
It could be good for benchmarks while not having to change existing code. It also makes it possible to build real world examples like "what's the price of gold" being updated every 30 seconds, hitting the cache all other times.
Alternatively the API could be that you just add an integer after the handler, for how many seconds the cache is valid, defaulting to 0. Then you could mix cached endpoints with non-cached ones seamlessly.