1
Firebase 용 클라우드 기능을 사용하여 FCM 메시지를 전송하는 기본 사용 사례를 보내려고합니다. 함수가 시간 초과되어 메시지가 전송되지 않습니다. 여기에 함수가 있습니다.Firebase 용 클라우드 기능을 사용하여 FCM 메시지를 전송할 수 없습니다.
exports.sendNotification = functions.https.onRequest((req, res) => {
const keyword = req.query.keyword;
const username = req.query.username;
var payload = {
data: {
SearchKeyword: keyword,
user: username
}
};
const token = "real_fcm_token";
return admin.messaging().sendToDevice(token, payload);
});
장치에 데이터 메시지를 보낼 수 있도록 위의 코드 블록을 어떻게 업데이트 할 수 있습니까?
감사합니다. 시간 초과 문제가 해결되었지만 어떤 이유로 FCM 메시지가 계속 전송되지 않습니다. –
@ValOkafor :'sendToDevice()'는 약속의 [MessagingDevicesResponse] (https://firebase.google.com/docs/reference/admin/node/admin.messaging.MessagingDevicesResponse)를 반환합니다. 여기에서 [예제 코드] (https://firebase.google.com/docs/cloud-messaging/admin/send-messages#send_to_individual_devices)에서 성공/실패 상태를 확인할 수 있습니다. –
감사합니다. –