title: How to close Server-Sent Events events
body: <p>I want to know how to close a server-sent events via JavaScript. Below is my dummy code:</p>
  
  <pre><code>var ser=new EventSource("path");
  ser.onmessage=function(ev){
  if(!ev)
     //want to close HERE!!
  else
     console.log(ev);
  }
  </code></pre>