The API call result was not normally contained in the (info) object because node…
…js processed the function asynchronously. So we used the following grammar rules, async, await, and changed it to call api synchronously. Good operation
Showing
2 changed files
with
5 additions
and
6 deletions
This diff is collapsed. Click to expand it.
... | @@ -38,20 +38,19 @@ | ... | @@ -38,20 +38,19 @@ |
38 | ></div> | 38 | ></div> |
39 | </div> | 39 | </div> |
40 | </div> | 40 | </div> |
41 | -<<<<<<< HEAD | ||
42 | 41 | ||
43 | <script src="/socket.io/socket.io.js"></script> | 42 | <script src="/socket.io/socket.io.js"></script> |
44 | <script> | 43 | <script> |
45 | - var socket = io.connect('/'); | 44 | + var socket = io('http://localhost',{transports: ['websocket']}); |
46 | - socket.emit("connection"); | 45 | + socket.emit("connection",()=>{ |
47 | - socket.on("weatherInfo_minutely_send_to_cliend",(info)=>{ //서버에서 client에게 메세지 전송 | 46 | + console.log("connected"); |
47 | + }); | ||
48 | + socket.on("weatherInfo_minutely_send_to_client",(info)=>{ //서버에서 client에게 메세지 전송 | ||
48 | console.log(info); | 49 | console.log(info); |
49 | }); | 50 | }); |
50 | </script> | 51 | </script> |
51 | 52 | ||
52 | -======= | ||
53 | 53 | ||
54 | ->>>>>>> 0f5edf6316e2444f5fd2a050fed5e771e5141733 | ||
55 | <!-- 첫번째 그래프 --> | 54 | <!-- 첫번째 그래프 --> |
56 | <script type="text/javascript"> | 55 | <script type="text/javascript"> |
57 | Highcharts.chart("container1", { | 56 | Highcharts.chart("container1", { | ... | ... |
-
Please register or login to post a comment