Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
API example of AJAP responses
class SomethingController
include AjapController
defer_response :only => :slow_operation
def slow_operation
later do |ajap|
Leviathan.do_something_very_slowly.callback do |result|
ajap.respond :status => 200, :message => result
end
end
end
end
class Workers::SomethingElse
def handle_message(message)
Ajap.later(message['pusher_channel'], message['ajap_event_id']) do |ajap|
Leviathan.do_something_else_very_slowly.callback do |result|
ajap.respond :status => 200, :message => result
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.