Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
class MessageBroadcastJob < ApplicationJob
queue_as :default
def perform(message)
ActionCable.server.broadcast 'room_channel', message: ActiveSupport::JSON.decode(render_message(message))
end
private
def render_message(message)
ApplicationController.renderer.render(partial: "messages/message.json.jbuilder", locals: {message: message})
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.