firebase:: messaging:: Message
#include <messaging.h>
Data structure used to receive messages from cloud messaging.
Summary
Constructors and Destructors |
|
---|---|
Message()
Initialize the message.
|
|
Message(const Message & other)
Copy constructor. Makes a deep copy of this Message.
|
|
~Message()
Destructor.
|
Public attributes |
|
---|---|
collapse_key
|
std::string
This parameter identifies a group of messages (e.g., with collapse_key: "Updates Available") that can be collapsed, so that only the last message gets sent when delivery can be resumed.
|
data
|
std::map< std::string, std::string >
The metadata, including all original key/value pairs.
|
error
|
std::string
Error code.
|
error_description
|
std::string
Human readable details about the error.
|
from
|
std::string
Authenticated ID of the sender.
|
link
|
std::string
The link into the app from the message.
|
message_id
|
std::string
Message ID.
|
message_type
|
std::string
Equivalent with a content-type.
|
notification
|
Optional notification to show.
|
notification_opened
|
bool
A flag indicating whether this message was opened by tapping a notification in the OS system tray.
|
priority
|
std::string
Sets the priority of the message.
|
raw_data
|
std::vector< unsigned char >
Binary payload.
|
time_to_live
|
int32_t
This parameter specifies how long (in seconds) the message should be kept in FCM storage if the device is offline.
|
to
|
std::string
This parameter specifies the recipient of a message.
|
Public functions |
|
---|---|
operator=(const Message & other)
|
Message &
Copy assignment operator. Makes a deep copy of this Message.
|
Public attributes
collapse_key
std::string firebase::messaging::Message::collapse_key
This parameter identifies a group of messages (e.g., with collapse_key: "Updates Available") that can be collapsed, so that only the last message gets sent when delivery can be resumed.
This is intended to avoid sending too many of the same messages when the device comes back online or becomes active.
Note that there is no guarantee of the order in which messages get sent.
Note: A maximum of 4 different collapse keys is allowed at any given time. This means a FCM connection server can simultaneously store 4 different send-to-sync messages per client app. If you exceed this number, there is no guarantee which 4 collapse keys the FCM connection server will keep.
data
std::map< std::string, std::string > firebase::messaging::Message::data
The metadata, including all original key/value pairs.
Includes some of the HTTP headers used when sending the message. gcm
, google
and goog
prefixes are reserved for internal use.
error
std::string firebase::messaging::Message::error
Error code.
Used in "nack" messages for CCS, and in responses from the server. See the CCS specification for the externally-supported list.
error_description
std::string firebase::messaging::Message::error_description
Human readable details about the error.
from
std::string firebase::messaging::Message::from
Authenticated ID of the sender.
This is a project number in most cases.
Any value starting with google.com, goog. or gcm. are reserved.
link
std::string firebase::messaging::Message::link
The link into the app from the message.
message_id
std::string firebase::messaging::Message::message_id
Message ID.
This can be specified by sender. Internally a hash of the message ID and other elements will be used for storage. The ID must be unique for each topic subscription - using the same ID may result in overriding the original message or duplicate delivery.
message_type
std::string firebase::messaging::Message::message_type
Equivalent with a content-type.
Defined values:
- "deleted_messages" - indicates the server had too many messages and dropped some, and the client should sync with his own server. Current limit is 100 messages stored.
- "send_event" - indicates an upstream message has been pushed to the FCM server. It does not guarantee the upstream destination received it. Parameters: "message_id"
- "send_error" - indicates an upstream message expired, without being sent to the FCM server. Parameters: "message_id" and "error"
If this field is missing, the message is a regular message.
notification
Notification * firebase::messaging::Message::notification
Optional notification to show.
This only set if a notification was received with this message, otherwise it is null.
The notification is only guaranteed to be valid during the call to Listener::OnMessage(). If you need to keep it around longer you will need to make a copy of either the Message or Notification. Copying the Message object implicitly makes a deep copy of the notification (allocated with new) which is owned by the Message.
notification_opened
bool firebase::messaging::Message::notification_opened
A flag indicating whether this message was opened by tapping a notification in the OS system tray.
If the message was received this way this flag is set to true.
priority
std::string firebase::messaging::Message::priority
Sets the priority of the message.
Valid values are "normal" and "high." On iOS and tvOS, these correspond to APNs priority 5 and 10.
By default, messages are sent with normal priority. Normal priority optimizes the client app's battery consumption, and should be used unless immediate delivery is required. For messages with normal priority, the app may receive the message with unspecified delay.
When a message is sent with high priority, it is sent immediately, and the app can wake a sleeping device and open a network connection to your server.
For more information, see Setting the priority of a message.
raw_data
std::vector< unsigned char > firebase::messaging::Message::raw_data
Binary payload.
time_to_live
int32_t firebase::messaging::Message::time_to_live
This parameter specifies how long (in seconds) the message should be kept in FCM storage if the device is offline.
The maximum time to live supported is 4 weeks, and the default value is 4 weeks. For more information, see Setting the lifespan of a message.
to
std::string firebase::messaging::Message::to
This parameter specifies the recipient of a message.
For example it can be a registration token, a topic name, an Instance ID or project ID.
[email protected] or Instance ID are accepted.
Public functions
Message
firebase::messaging::Message::Message()
Initialize the message.
Message
firebase::messaging::Message::Message( const Message & other )
Copy constructor. Makes a deep copy of this Message.
operator=
Message & firebase::messaging::Message::operator=( const Message & other )
Copy assignment operator. Makes a deep copy of this Message.
~Message
firebase::messaging::Message::~Message()
Destructor.