FCMServiceClient
public protocol FCMServiceClient
The FCM service client, which can be used to send push notifications to other users via MongoDB Stitch.
-
Sends an FCM message to the given target with the given request payload.
Declaration
Swift
func sendMessage(to target: String, withRequest request: FCMSendMessageRequest, _ completionHandler: @escaping (StitchResult<FCMSendMessageResult>) -> Void)
Parameters
to
the target to send a message to.
withRequest
the details of the message.
completionHandler
The completion handler to call when the message is sent or the operation fails. This handler is executed on a non-main global
DispatchQueue
. If the operation is successful, the result will contain the result of the send message request as anFCMSendMessageRequest
. -
Sends an FCM message to the given set of Stitch users with the given request payload.
Declaration
Swift
func sendMessage(toUserIDs userIDs: [String], withRequest request: FCMSendMessageRequest, _ completionHandler: @escaping (StitchResult<FCMSendMessageResult>) -> Void)
Parameters
toUserIDs
the Stitch users to send a message to.
withRequest
the details of the message.
completionHandler
The completion handler to call when the message is sent or the operation fails. This handler is executed on a non-main global
DispatchQueue
. If the operation is successful, the result will contain the result of the send message request as anFCMSendMessageRequest
. -
Sends an FCM message to the given set of registration tokens with the given request payload.
Declaration
Swift
func sendMessage(toRegistrationTokens registrationTokens: [String], withRequest request: FCMSendMessageRequest, _ completionHandler: @escaping (StitchResult<FCMSendMessageResult>) -> Void)
Parameters
withRequest
the details of the message.
completionHandler
The completion handler to call when the message is sent or the operation fails. This handler is executed on a non-main global
DispatchQueue
. If the operation is successful, the result will contain the result of the send message request as anFCMSendMessageRequest
.