Skip to content

HTTP v1 fixed dependency👩🏻‍🍼

Compare
Choose a tag to compare
@sabman sabman released this 26 Nov 03:15
· 55 commits to master since this release

This release adds support for send_v1 method that allows sending via HTTP v1. See the official migration guide for more info. This release is somewhat of a work around until the next release will refactor this to use namespace and deprecate this method.

Example the the new version:

fcm = FCM.new(
  API_TOKEN,
  GOOGLE_APPLICATION_CREDENTIALS_PATH,
  FIREBASE_PROJECT_ID
)
message = {
  'topic': "89023", # OR token if you want to send to a specific device
  # 'token': "000iddqd",
  'data': {
    payload: {
      data: {
        id: 1
      }
    }.to_json
  },
  'notification': {
    title: notification.title_th,
    body: notification.body_th,
  },
  'android': {},
  'apns': {
    payload: {
      aps: {
        sound: "default",
        category: "#{Time.zone.now.to_i}"
      }
    }
  },
  'fcm_options': {
    analytics_label: 'Label'
  }
}

fcm.send_v1(message)