Method: ActivityNotification::OptionalTarget::ActionCableApiChannel#format_message

Defined in:
lib/activity_notification/optional_targets/action_cable_api_channel.rb

#format_message(notification, options = {}) ⇒ Hash

Format message to broadcast

Parameters:

  • notification (Notification)

    Notification instance

  • options (Hash) (defaults to: {})

    Options for publishing

Returns:

  • (Hash)

    Formatted message to broadcast



36
37
38
39
40
41
# File 'lib/activity_notification/optional_targets/action_cable_api_channel.rb', line 36

def format_message(notification, options = {})
  {
    notification: notification.as_json(notification_json_options.merge(options)),
    group_owner:  notification.group_owner? ? nil : notification.group_owner.as_json(notification_json_options.merge(options))
  }
end