Showing
1 changed file
with
18 additions
and
11 deletions
... | @@ -34,6 +34,7 @@ module.exports = (server, app) => { | ... | @@ -34,6 +34,7 @@ module.exports = (server, app) => { |
34 | let Discomport_index={}; | 34 | let Discomport_index={}; |
35 | let Ultra_Violet_index={}; | 35 | let Ultra_Violet_index={}; |
36 | let sending_to_client_info={}; | 36 | let sending_to_client_info={}; |
37 | + let client_send={}; | ||
37 | 38 | ||
38 | socket.on("connection", () => { | 39 | socket.on("connection", () => { |
39 | API_CALL = setInterval(() => { | 40 | API_CALL = setInterval(() => { |
... | @@ -48,16 +49,16 @@ module.exports = (server, app) => { | ... | @@ -48,16 +49,16 @@ module.exports = (server, app) => { |
48 | heat : Sensible_T.weather.wIndex.heatIndex[0].current.index, //열지수 | 49 | heat : Sensible_T.weather.wIndex.heatIndex[0].current.index, //열지수 |
49 | sensible_temperature : Sensible_T.weather.wIndex.wctIndex[0].current.index, //체감온도 | 50 | sensible_temperature : Sensible_T.weather.wIndex.wctIndex[0].current.index, //체감온도 |
50 | discomport : Discomport_index.weather.wIndex.thIndex[0].current.index, //불쾌지수 | 51 | discomport : Discomport_index.weather.wIndex.thIndex[0].current.index, //불쾌지수 |
51 | - UV : Ultra_Violet_index.weather.wIndex.uvindex[0].day00.index, | 52 | + UV : Ultra_Violet_index.weather.wIndex.uvindex[0].day00.index, //자외선지수 |
52 | - windspd : Current_Weather.weather.minutely[0].wind.wspd, | 53 | + windspd : Current_Weather.weather.minutely[0].wind.wspd, //바람 속도 |
53 | - sky : Current_Weather.weather.minutely[0].sky.code, | 54 | + sky : Current_Weather.weather.minutely[0].sky.code, //하늘 상태 |
54 | - rain : Current_Weather.weather.minutely[0].rain.last24hour, | 55 | + rain : Current_Weather.weather.minutely[0].rain.last24hour, //강수량 |
55 | - current_temperature : Current_Weather.weather.minutely[0].temperature.tc, | 56 | + current_temperature : Current_Weather.weather.minutely[0].temperature.tc, //현재 온도 |
56 | - lightning : Current_Weather.weather.minutely[0].lightning, | 57 | + lightning : Current_Weather.weather.minutely[0].lightning, //현재 낙뢰 |
57 | - warning : common.alertYn, | 58 | + warning : Current_Weather.common.alertYn, //현재 특보 유무 |
58 | - typhoon : Current_Weather.common.stormYn, | 59 | + typhoon : Current_Weather.common.stormYn, //현재 태풍 |
59 | - time : Current_Weather.weather.minutely[0].timeObservation, | 60 | + time : Current_Weather.weather.minutely[0].timeObservation, // 불러온 시각 |
60 | - death_prob:0 | 61 | + death_prob:0 //확률 |
61 | } | 62 | } |
62 | 63 | ||
63 | info.death_prob += info.sky.substr(5)*1 //하늘 상태에 따라 확률 증가 | 64 | info.death_prob += info.sky.substr(5)*1 //하늘 상태에 따라 확률 증가 |
... | @@ -75,8 +76,14 @@ module.exports = (server, app) => { | ... | @@ -75,8 +76,14 @@ module.exports = (server, app) => { |
75 | + (info.windspd*3) + (info.rain/10) + (abs(info.current_temperature-15)/2) | 76 | + (info.windspd*3) + (info.rain/10) + (abs(info.current_temperature-15)/2) |
76 | ); | 77 | ); |
77 | 78 | ||
79 | + client_send={ | ||
80 | + rain : info.rain, | ||
81 | + wind : info.windspd, | ||
82 | + temperature : info.current_temperature, | ||
83 | + death : info.death_prob | ||
84 | + } | ||
78 | 85 | ||
79 | - socket.emit("weatherInfo_minutely_send_to_client",info); // 클라이언트에게 이벤트 발산 | 86 | + socket.emit("weatherInfo_minutely_send_to_client",client_send); // 클라이언트에게 정보 담아서 이벤트 발산 |
80 | }, 60 * 1000); //1분마다 호출 | 87 | }, 60 * 1000); //1분마다 호출 |
81 | }); | 88 | }); |
82 | 89 | ... | ... |
-
Please register or login to post a comment