Answer the question
In order to leave comments, you need to log in
SSE, what determines the return time, how serious is the load on the server?
I started digging towards SSE to return game statistics.
I actually looked at this example:
public function actionIndex()
{
print('
<div id="help"></div>
<script type="text/javascript">
var help = document.getElementById("help");
var source = new EventSource(\'/site/sse/server/\');
source.onmessage = function(event){
help.innerHTML += event.data;}
</script>
');
}
public function actionServer()
{
header("Content-Type: text/event-stream");
$t = date("H:i:s") ."<br />";
echo "data: $t\n";
echo "\n";
}
04:38:32
04:38:39
04:38:45
04:38:51
04:38:57
04:39:03
04:39:10
04:39:16
04:39:23
04:39:29
04:39:35
04:39:42
04:39:48
04:39:54
04:40:00
04:40:06
04:40:13
04:40:19
04:40:25
04:40:31
04:40:37
04:40:43
04:40:50
04:40:56
04:41:02
04:41:08
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question