sidekiq: push background results to front

Rails 3.2.11 Sidekiq latest

My app continues background jobs that generate texts as the output.

class ProcessText     include Sidekiq::Worker

    def perform(name, count)         puts "executing..."         @feed = Feed.first         @feed.process # here it returns String results!     end end

What I want is basically how to send (or push?) the result texts to a particular web page.

The above function 'perform' is in app/workers directory, as instructed in the documentation of Sidekiq. It must be simple but I am unable to find the way to do it yet. Somehow I need to let a controller reload the page, OR with the help of jquery ajax, to show the results, I guess?

Could anyone give me tips?

soichi

Rails 3.2.11 Sidekiq latest

My app continues background jobs that generate texts as the output.

class ProcessText    include Sidekiq::Worker

   def perform(name, count)        puts "executing..."        @feed = Feed.first        @feed.process # here it returns String results!    end end

What I want is basically how to send (or push?) the result texts to a particular web page.

The above function 'perform' is in app/workers directory, as instructed in the documentation of Sidekiq. It must be simple but I am unable to find the way to do it yet. Somehow I need to let a controller reload the page, OR with the help of jquery ajax, to show the results, I guess?

Could anyone give me tips?

Rails 4 will let you stream the update to the page, but in Rails < 4, you want to have the page poll for changes. Use Prototype's Ajax.PeriodicalUpdater or whatever the jQuery equivalent is. Prototype's can be configured to throttle back the frequency of requests after a period of same-results answers, and of course you can remove the behavior once the update has been delivered.

Walter