pub struct FirebaseMessaging { /* private fields */ }Expand description
Client for interacting with Firebase Cloud Messaging.
Implementations§
Source§impl FirebaseMessaging
impl FirebaseMessaging
Sourcepub fn new(middleware: AuthMiddleware) -> Self
pub fn new(middleware: AuthMiddleware) -> Self
Creates a new FirebaseMessaging instance.
This is typically called via FirebaseApp::messaging().
Sourcepub async fn send(
&self,
message: &Message,
dry_run: bool,
) -> Result<String, MessagingError>
pub async fn send( &self, message: &Message, dry_run: bool, ) -> Result<String, MessagingError>
Sends a message to a specific target (token, topic, or condition).
§Arguments
message- TheMessagestruct defining the payload and target.dry_run- If true, the message will be validated but not sent.
Sourcepub async fn send_each(
&self,
messages: &[Message],
dry_run: bool,
) -> Result<BatchResponse, MessagingError>
pub async fn send_each( &self, messages: &[Message], dry_run: bool, ) -> Result<BatchResponse, MessagingError>
Sends a batch of messages.
This uses the FCM batch endpoint to send up to 500 messages in a single HTTP request.
§Arguments
messages- A slice ofMessagestructs.dry_run- If true, the messages will be validated but not sent.
Sourcepub async fn send_each_for_multicast(
&self,
message: &MulticastMessage,
dry_run: bool,
) -> Result<BatchResponse, MessagingError>
pub async fn send_each_for_multicast( &self, message: &MulticastMessage, dry_run: bool, ) -> Result<BatchResponse, MessagingError>
Sends a multicast message to all specified tokens.
This is a wrapper around send_each that constructs individual messages for each token.
§Arguments
message- TheMulticastMessagecontaining tokens and payload.dry_run- If true, the messages will be validated but not sent.
Sourcepub async fn subscribe_to_topic(
&self,
tokens: &[&str],
topic: &str,
) -> Result<TopicManagementResponse, MessagingError>
pub async fn subscribe_to_topic( &self, tokens: &[&str], topic: &str, ) -> Result<TopicManagementResponse, MessagingError>
Subscribes a list of tokens to a topic.
§Arguments
tokens- A list of device registration tokens.topic- The name of the topic.
Sourcepub async fn unsubscribe_from_topic(
&self,
tokens: &[&str],
topic: &str,
) -> Result<TopicManagementResponse, MessagingError>
pub async fn unsubscribe_from_topic( &self, tokens: &[&str], topic: &str, ) -> Result<TopicManagementResponse, MessagingError>
Unsubscribes a list of tokens from a topic.
§Arguments
tokens- A list of device registration tokens.topic- The name of the topic.
Trait Implementations§
Source§impl Clone for FirebaseMessaging
impl Clone for FirebaseMessaging
Source§fn clone(&self) -> FirebaseMessaging
fn clone(&self) -> FirebaseMessaging
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for FirebaseMessaging
impl !RefUnwindSafe for FirebaseMessaging
impl Send for FirebaseMessaging
impl Sync for FirebaseMessaging
impl Unpin for FirebaseMessaging
impl !UnwindSafe for FirebaseMessaging
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more