DESKTOP-PC6TBNS\강환석씨

api calling advanced

This diff is collapsed. Click to expand it.
......@@ -21,24 +21,29 @@ module.exports = (server, app) => {
if (err) throw err;
// api의 대답이 있을경우 실행
if (api_res) {
console.log(api_body);
// api_body.weather.minutely[0]
return api_body;
// api_body.weather.minutely[0]
}
});
}
io.on('connection', (socket) => { //웹 페이지 연결시 루프 동작
let API_CALL;
let Current_Weather;
let Sensible_T;
let Heat_index;
let Discomport_index;
let Ultra_Violet_index;
socket.on("connection", () => {
API_CALL = setInterval(() => {
CALL("current","minutely"); //현재날씨 (분별)
CALL("index","wct"); //체감온도
CALL("index","heat"); //열지수
CALL("index","th"); //불쾌지수
CALL("index","uv"); //자외선지수
Current_Weather = CALL("current","minutely"); //현재날씨 (분별)
Sensible_T = CALL("index","wct"); //체감온도
Heat_index = CALL("index","heat"); //열지수
Discomport_index = CALL("index","th"); //불쾌지수
Ultra_Violet_index = CALL("index","uv"); //자외선지수
socket.emit("weatherInfo_minutely_send_to_cliend",info);
}, 60 * 1000); //1분마다 호출
});
......@@ -50,3 +55,4 @@ module.exports = (server, app) => {
}
......
......@@ -1071,7 +1071,8 @@
"jsbn": "0.1.1",
"safer-buffer": "2.1.2",
"tweetnacl": "0.14.5"
},
}
},
"sqlstring": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/sqlstring/-/sqlstring-2.3.1.tgz",
......@@ -1144,7 +1145,8 @@
"integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==",
"requires": {
"punycode": "2.1.1"
},
}
},
"util-deprecate": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
......@@ -1199,4 +1201,4 @@
"integrity": "sha1-AI4G2AlDIMNy28L47XagymyKxBk="
}
}
}
}
\ No newline at end of file
......