Toggle navigation
Toggle navigation
This project
Loading...
Sign in
MotherProject
/
Probability Death
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
DESKTOP-PC6TBNS\강환석씨
2018-12-09 16:12:25 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
89cdef692589939467e82b1fbb8cbbaddd22111e
89cdef69
1 parent
f203460e
api calling advanced
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
12 deletions
lib/example_result.json
lib/socketio.js
package-lock.json
lib/example_result.json
View file @
89cdef6
This diff is collapsed. Click to expand it.
lib/socketio.js
View file @
89cdef6
...
...
@@ -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"
);
//자외선지수
C
urrent_Weather
=
C
ALL
(
"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) => {
}
...
...
package-lock.json
View file @
89cdef6
...
...
@@ -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
...
...
Please
register
or
login
to post a comment