3 ms·
Render-async lets the client render the page, and then request "partials" from the server, the backend sees two different requests from the browser The inline
by kawsper 9y ago
Render-async lets the client render the page, and then request "partials" from the server, the backend sees two different requests from the browser
The inline includes that Varnish does is synchronous for the client, but asynchronous in your backend, your backend sees multiple requests.
I am interested in your pusher+sidekiq implementation, it is a good idea, but it might be a lot of work :)
- gingerlime 9y agoIt's definitely more involved, and might be slightly more complex to generalize, but in essence it's quite straight-forward: 1. Client sends a request via Ajax to a rails controller and simultaneously opens a private pusher channel to wait for a response. 2. Controller returns a response immediately and fires-off a sidekiq job. 3. The sidekiq job does the heavy lifting and pushes the results back via pusher (it can be JSON data, or a rendered partial). 4. Client receives the response via the pusher channel and shows it on the page.