2016-08-28 9 views

答えて

0

FCMトークンを取得するには、fcm-nodeパッケージを使用しますか。私たちは、私たちはXMPPのCCSサーバーを使用する必要がupstraemメッセージについては、この

msg='new notification for you' 
title='Hello' 
id='34' 
user_id='34' 
result='api_token'//save this token in database and retrive using user_id 
SendNotification(msg,title,'START_APPOINTMENT',id,user_id,result); 
+2

のように、この関数を呼び出すモバイル

var FCM = require('fcm-node'); exports.SendNotification = function(msg,title,type,id,user_id,api_token) { var fcm = new FCM(constants.serverKey); var message = { registration_ids : api_token, notification: { title: title, body:msg }, data: { type: type, id:id, user_id:user_id } }; fcm.send(message, function(err, response){ if (err) { console.log("Error for Send Notification",err); return; } else { console.log("Successfully sent Notification", response); return; } }); } 

に送信通知のためにそれを使用し、より持っている私の完全なコーディングでのデバイスの外観を登録できることを利用し、 'node-xcs'はそれを処理するモジュールです。私は 'fcm-node'はこの場合には役に立たないと思います。 –

+0

@KrishnaAgrawal多くのありがとう。そのモジュールを見つけるのに数時間かかりました。それは答えでなければなりません。私はまだそれを試していないtho。何か別の選択肢はありますか? – aung

+0

@aungこれのためのより良い選択肢が見つかりませんでした。 'node-xcs'は私のために完璧に働いています。 –

関連する問題