2017-02-14 12 views
0

Nodejsサーバーから通知を送信したいのですが、解決方法がわからないエラーが表示されています。誰か助けてくれますか?私は、インターネット上でこの可能な解決策を見つけた - >URLFcm通知android/IOS nodejs

これはnodejs

var FCM = require('fcm-push'); 

function sendNotification(){ 

var serverKey = 'AAAAJnK3Ing:AP-(more caracters)AwAlBL_CvXIkFM2UufYZHYkvhC7FP3Tu16mlI'; 
var fcm = new FCM(serverKey); 

var message = { 
    to: 'd2b2v(more caracters token)DUmAXqU-uHptJJLRPXukl', 
    /*data: { 
     your_custom_data_key: 'your_custom_data_value' 
    },*/ 
    notification: { 
     title: 'notification', 
     body: 'This is a notification from node' 
    } 
}; 

//callback style 
fcm.send(message, function(err, response){ 
    if (err) { 
     console.log("****************************************************") 
     console.log(message) 
     console.log("Something has gone wrong!"); 
    } else { 
     console.log("Successfully sent with response: ", response); 
    } 
}); 

//promise style 
fcm.send(message) 
    .then(function(response){ 
     console.log("Successfully sent with response: ", response); 
    }) 
    .catch(function(err){ 
     console.log("----------------------------------------------------") 
     console.log("Something has gone wrong!"); 
     console.error(err); 
    }) 

} 

module.exports = { 
    sendNotification 
} 

I am getting this error

答えて

0

で私のコードでは、あなたのファイアウォールが443ポートに接続することを許可しているかどうかを確認してください。それは接続を作成できないようです。

+0

はい、開いて聞いています –

関連する問題