1
nodejs 인스턴스가있는 OpenShift 클라우드 서버를 시험 중입니다. oneSignal API에 대한 POST 요청을 수행하려고합니다.OpenShift : nodejs에서 여러 게시물 요청이 실행 중입니다.
POST는 성공했지만 oneSignal은 단일 POST에 대해 4 개의 알림을 보냅니다.
내 로컬 컴퓨터에서 다음 코드를 실행하면 단일 알림이 표시되지만 코드가 OpenShift에 배포 될 때 4 가지 알림이 표시되므로 OpenShift 서버에서 문제가 발생했다고 생각합니다.
var request = require('request');
function sendNotification() {
var data = {};
data.headings = {"en": "Trial Push Heading"}
data.contents = {"en": "Trial Push Contents"};
data.app_id = MY_APP_ID;
data.included_segments = ["All"];
var headers = {
"Content-Type": "application/json",
"Authorization": "Basic "+ MY_AUTH_KEY
};
var options = {
url: "https://onesignal.com/api/v1/notifications",
method: "POST",
headers: headers,
json: data
};
request(options, function (error, response, body) {
if (!error && response.statusCode == 200) {
console.log(body) // Print the shortened url.
}
});
};