Skip to content

Latest commit

 

History

History
338 lines (122 loc) · 5.59 KB

LaravelFCM-Response-DownstreamResponse.md

File metadata and controls

338 lines (122 loc) · 5.59 KB

LaravelFCM\Response\DownstreamResponse

Class DownstreamResponse

Constants

MULTICAST_ID

const MULTICAST_ID = 'multicast_id'

CANONICAL_IDS

const CANONICAL_IDS = "canonical_ids"

RESULTS

const RESULTS = "results"

MISSING_REGISTRATION

const MISSING_REGISTRATION = "MissingRegistration"

MESSAGE_ID

const MESSAGE_ID = "message_id"

REGISTRATION_ID

const REGISTRATION_ID = "registration_id"

NOT_REGISTERED

const NOT_REGISTERED = "NotRegistered"

INVALID_REGISTRATION

const INVALID_REGISTRATION = "InvalidRegistration"

UNAVAILABLE

const UNAVAILABLE = "Unavailable"

DEVICE_MESSAGE_RATE_EXCEEDED

const DEVICE_MESSAGE_RATE_EXCEEDED = "DeviceMessageRateExceeded"

INTERNAL_SERVER_ERROR

const INTERNAL_SERVER_ERROR = "InternalServerError"

SUCCESS

const SUCCESS = 'success'

FAILURE

const FAILURE = 'failure'

ERROR

const ERROR = "error"

Methods

__construct

mixed LaravelFCM\Response\BaseResponse::__construct(\GuzzleHttp\Psr7\Response $response)

BaseResponse constructor.

Arguments

  • $response GuzzleHttp\Psr7\Response

parseResponse

mixed LaravelFCM\Response\BaseResponse::parseResponse(array $responseInJson)

parse the response

Arguments

  • $responseInJson array

merge

mixed LaravelFCM\Response\DownstreamResponseContract::merge(\LaravelFCM\Response\DownstreamResponse $response)

Merge two response

Arguments

numberSuccess

integer LaravelFCM\Response\DownstreamResponseContract::numberSuccess()

Get the number of device reached with success

numberFailure

integer LaravelFCM\Response\DownstreamResponseContract::numberFailure()

Get the number of device which thrown an error

numberModification

integer LaravelFCM\Response\DownstreamResponseContract::numberModification()

Get the number of device that you need to modify their token

tokensToDelete

array LaravelFCM\Response\DownstreamResponseContract::tokensToDelete()

get token to delete

remove all tokens returned by this method in your database

tokensToModify

array LaravelFCM\Response\DownstreamResponseContract::tokensToModify()

get token to modify

key: oldToken value: new token

find the old token in your database and replace it with the new one

tokensToRetry

array LaravelFCM\Response\DownstreamResponseContract::tokensToRetry()

Get tokens that you should resend using exponential backoof

tokensWithError

array LaravelFCM\Response\DownstreamResponseContract::tokensWithError()

Get tokens that thrown an error

key : token value : error

In production, remove these tokens from you database

hasMissingToken

boolean LaravelFCM\Response\DownstreamResponseContract::hasMissingToken()

check if missing tokens was given to the request If true, remove all the empty token in your database

isJsonResponse

mixed LaravelFCM\Response\BaseResponse::isJsonResponse(\GuzzleHttp\Psr7\Response $response)

Check if the response given by fcm is parsable

Arguments

  • $response GuzzleHttp\Psr7\Response

logResponse

mixed LaravelFCM\Response\BaseResponse::logResponse()

Log the response