Reputation: 439
I am using 'Sidekiq' to schedule reminder about any task on given time. Its working perfect. Now i want to append it to notify on my navbar, for it i am using 'Private Pub' to publish the reminder message. Here is code of Sidekiq Worker.
class ReminderWorker
include Sidekiq::Worker
def perform(args)
reminder = Reminder.find(args['id'])
reminder.activate = true
PrivatePub.publish_to("reminder", message: reminder)
reminder.save
end
end
and inside "application.js" i am using alert for testing but it is not working.
PrivatePub.subscribe("reminder", function(data, channel) {
return alert('Remarks ='+ data.message.remarks);
});
Am i missing some thing? As it is possible to publish data through Private Pub in rb file accourding to Ryan http://railscasts.com/episodes/316-private-pub?autoplay=true
Upvotes: 0
Views: 129
Reputation: 1526
This gem has been updated last time three years ago and seems not maintained. Maybe it's better to use newest rails solution like ActionCabble? https://github.com/rails/rails/tree/master/actioncable
I found this issue, that proofs that ActionCabble can be integrated to ActiveJob or other background workers:
https://github.com/rails/rails/issues/22897
Upvotes: 0