HTML
1 <html lang="ja"> 2 <head> 3 <meta charset="utf-8"> 4 <title>index.html</title> 5 </head> 6 <body> 7 <button onclick="hoge()">hoge</button> 8 <script> 9 function hoge(){ 10 var es = new EventSource('/result'); 11 es.onmessage = function(e) { 12 console.log(e); 13 }; 14 } 15 </script> 16 </body> 17 </html>
hogeを何度もクリックした場合、その数だけコネクションができてしまいサーバー負荷になるのでしょうか?それともnewした段階で以前のコネクションはちゃんとcloseされるのでしょうか?
あなたの回答
tips
プレビュー