Skip to content

Instantly share code, notes, and snippets.

@louisremi
Created May 27, 2011 12:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save louisremi/995177 to your computer and use it in GitHub Desktop.
Save louisremi/995177 to your computer and use it in GitHub Desktop.
Server Sent Events
var evtSrc = new EventSource("http://example.com/server.php");
evtSrc.onmessage = function ( event ) {
event.data // do something with the data
}
@rwaldron
Copy link

It should be noted that EventSource requires URIs to be same-origin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment