So I'm currently using socket.io for a loading screen and it just isn't working so I'm going to try a different solution. I need the following to happen: user opens up my app--this triggers a function on the server side (CPU intensive scraping function that takes about 8 seconds). As soon as function is done, I need to notify the client that the function is done and the client fetches the results (after this result is fetched the app loading screen closes and the user enters the app).
My current implementation is using socket.io emissions and processing the scraping function via Redis queue on a background thread.
Is there a different approach to doing this instead of a socket connection and sending emissions from client -> server and vice versa?
I don't think I can just to a classic GET request, because isn't it bad practice to leave a long running (8 second) request open for so long while waiting for response? Also, I looked into Server-Sent Events but I'm not sure I would be able to use it in this case.
Any insight is much appreciated!