Created
November 19, 2012 22:07
-
-
Save icewind1991/4114368 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if(isset($_GET['run'])){ | |
$eventSource = new OC_EventSource(); | |
for($i=0;$i<100;$i++){ | |
$eventSource->send('tick',$i); | |
sleep(1); | |
} | |
$eventSource->close(); | |
} | |
?> | |
<html> | |
<head> | |
<script> | |
var eventSource = new OC.EventSource('es.php',{run:true}); | |
eventSource.listen('tick', function(i){ | |
console.log(i); | |
}); | |
</script> | |
</head> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Cool! THX a lot!