DESKTOP-PC6TBNS\강환석씨

api calling advanced

This diff is collapsed. Click to expand it.
...@@ -21,24 +21,29 @@ module.exports = (server, app) => { ...@@ -21,24 +21,29 @@ module.exports = (server, app) => {
21 if (err) throw err; 21 if (err) throw err;
22 // api의 대답이 있을경우 실행 22 // api의 대답이 있을경우 실행
23 if (api_res) { 23 if (api_res) {
24 - console.log(api_body); 24 + return api_body;
25 - // api_body.weather.minutely[0] 25 + // api_body.weather.minutely[0]
26 } 26 }
27 }); 27 });
28 } 28 }
29 io.on('connection', (socket) => { //웹 페이지 연결시 루프 동작 29 io.on('connection', (socket) => { //웹 페이지 연결시 루프 동작
30 let API_CALL; 30 let API_CALL;
31 - 31 + let Current_Weather;
32 - 32 + let Sensible_T;
33 + let Heat_index;
34 + let Discomport_index;
35 + let Ultra_Violet_index;
36 +
33 socket.on("connection", () => { 37 socket.on("connection", () => {
34 API_CALL = setInterval(() => { 38 API_CALL = setInterval(() => {
35 39
36 - CALL("current","minutely"); //현재날씨 (분별) 40 + Current_Weather = CALL("current","minutely"); //현재날씨 (분별)
37 - CALL("index","wct"); //체감온도 41 + Sensible_T = CALL("index","wct"); //체감온도
38 - CALL("index","heat"); //열지수 42 + Heat_index = CALL("index","heat"); //열지수
39 - CALL("index","th"); //불쾌지수 43 + Discomport_index = CALL("index","th"); //불쾌지수
40 - CALL("index","uv"); //자외선지수 44 + Ultra_Violet_index = CALL("index","uv"); //자외선지수
41 45
46 + socket.emit("weatherInfo_minutely_send_to_cliend",info);
42 }, 60 * 1000); //1분마다 호출 47 }, 60 * 1000); //1분마다 호출
43 }); 48 });
44 49
...@@ -50,3 +55,4 @@ module.exports = (server, app) => { ...@@ -50,3 +55,4 @@ module.exports = (server, app) => {
50 55
51 56
52 } 57 }
58 +
......
...@@ -1071,7 +1071,8 @@ ...@@ -1071,7 +1071,8 @@
1071 "jsbn": "0.1.1", 1071 "jsbn": "0.1.1",
1072 "safer-buffer": "2.1.2", 1072 "safer-buffer": "2.1.2",
1073 "tweetnacl": "0.14.5" 1073 "tweetnacl": "0.14.5"
1074 - }, 1074 + }
1075 + },
1075 "sqlstring": { 1076 "sqlstring": {
1076 "version": "2.3.1", 1077 "version": "2.3.1",
1077 "resolved": "https://registry.npmjs.org/sqlstring/-/sqlstring-2.3.1.tgz", 1078 "resolved": "https://registry.npmjs.org/sqlstring/-/sqlstring-2.3.1.tgz",
...@@ -1144,7 +1145,8 @@ ...@@ -1144,7 +1145,8 @@
1144 "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==", 1145 "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==",
1145 "requires": { 1146 "requires": {
1146 "punycode": "2.1.1" 1147 "punycode": "2.1.1"
1147 - }, 1148 + }
1149 + },
1148 "util-deprecate": { 1150 "util-deprecate": {
1149 "version": "1.0.2", 1151 "version": "1.0.2",
1150 "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", 1152 "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
...@@ -1199,4 +1201,4 @@ ...@@ -1199,4 +1201,4 @@
1199 "integrity": "sha1-AI4G2AlDIMNy28L47XagymyKxBk=" 1201 "integrity": "sha1-AI4G2AlDIMNy28L47XagymyKxBk="
1200 } 1202 }
1201 } 1203 }
1202 -} 1204 +}
...\ No newline at end of file ...\ No newline at end of file
......