So sending network requests in PHP is blocking, which is kind of shitty, because each network request the app makes has to complete before the app continues execution. This is also sort of a bottleneck, because having the server handle all of the API requests could be a little heavy.
There are multiple ways that this could be make to be asynchronous.
- Rewrite the app in Node with ExpressJS
- Super intensive
- May not be worth.
- Would be a good experience to become familiar with Node and Express.
- Offload Reddit API requests to the browser.
- Would make the requests asynchronous.
- Gives work to the client that the server would have to do.
- Further decouples the front end from the back end, as long as the back end provides a list of usernames to grab IDs for, the app can just fire off requests for them.
- Possible security issue
- OAuth token must be sent to client for actions that require permissions
- CORS may not be enabled for all endpoints (probably ones that require a token or something)
So sending network requests in PHP is blocking, which is kind of shitty, because each network request the app makes has to complete before the app continues execution. This is also sort of a bottleneck, because having the server handle all of the API requests could be a little heavy.
There are multiple ways that this could be make to be asynchronous.