Module | Sinatra::Async::Helpers |
In: |
lib/sinatra/async.rb
|
aparams | [R] | aparams are used when inside of something that has been scheduled asynchronously in an asynchronous route. Essentially it is the last parameters to be set by the router (for example, containing the route captures). |
async_schedule is used to schedule work in a future context, the block is wrapped up so that exceptions and halts (redirect, etc) are handled correctly.
Send the given body or block as the final response to the asynchronous request.
By default native_async_schedule calls EventMachine#next_tick, if you‘re using threads or some other scheduling mechanism, it must take the block passed here and schedule it for running in the future.
The given block will be executed if the user closes the connection prematurely (before we‘ve sent a response). This is good for deregistering callbacks that would otherwise send the body (for example channel subscriptions).