Toggle navigation
Toggle navigation
This project
Loading...
Sign in
2019-1-OpenSourceSW
/
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 18:40:22 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
8d026b13a2690f8267601d87fb8d1154fe70e6c5
8d026b13
1 parent
82ea2e54
db insertion complete
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
3 deletions
lib/socketio.js
lib/socketio.js
View file @
8d026b1
...
...
@@ -35,6 +35,7 @@ module.exports = (server, app) => {
let
Ultra_Violet_index
=
{};
let
sending_to_client_info
=
{};
let
client_send
=
{};
let
sql
;
socket
.
on
(
"connection"
,
()
=>
{
API_CALL
=
setInterval
(()
=>
{
...
...
@@ -77,13 +78,19 @@ module.exports = (server, app) => {
);
client_send
=
{
rain
:
info
.
rain
,
time
:
info
.
time
,
wind
:
info
.
windspd
,
temperature
:
info
.
current_temperature
,
rain
:
info
.
rain
,
death
:
info
.
death_prob
}
}
;
socket
.
emit
(
"weatherInfo_minutely_send_to_client"
,
client_send
);
// 클라이언트에게 정보 담아서 이벤트 발산
//db에 저장
sql
=
"INSERT INTO weatherInfo (time,wind,temperature,rain,prob) VALUES (?,?,?,?,?)"
;
db
.
query
(
sql
,[
client_send
.
time
,
client_send
.
wind
,
client_send
.
temperature
,
client_send
.
rain
,
client_send
.
death
],(
err
,
result
)
=>
{
if
(
err
)
console
.
log
(
err
);
socket
.
emit
(
"weatherInfo_minutely_send_to_client"
,
client_send
);
// 클라이언트에게 정보 담아서 이벤트 발산
})
},
60
*
1000
);
//1분마다 호출
});
...
...
Please
register
or
login
to post a comment