问题
I don't know if Rails has a way to do as following:
- Receive a request
- Put the request into the monitor list until an event triggers
- Finish the request but does not return any response to the client (no HTTP response), the trigger will do the response later after processing.
I found some info about delayed_job, but it returns the response immediately and puts the job to the background which does not seem to be event-driven.
Anyone can help?
Andy.
回答1:
I think you are talking about callbacks. Read here: API. Note that you can create custom events and callbacks too: blog
回答2:
You're probably looking for Notifications, Observers, and/or COMET
来源:https://stackoverflow.com/questions/6972393/rails-how-to-have-no-response-until-an-event-triggers