}
}
+ /*
+ $response: raw stream data not sent
+ $content: html consistent data (<script bla bla>)
+ $user->stream_keepalive($w_ping) ping srv->cli OR srv->cli + cli->srv if $w_ping == TRUE
+ */
+
/* manage open streaming */
foreach ($this->socks as $k => $sock) {
if (isset($this->s2u[intval($sock)])) {
printf("[%s] [%d] [%d]\n", $user->name, $user->lacc, $this->curtime);
if ($content == "" && $user->ping_req == FALSE
&& (($this->curtime - $user->lacc) > (EXPIRE_TIME_RD / 2))) {
- $content = $user->stream_ping();
+ $content = $user->stream_keepalive(TRUE);
$user->ping_req = TRUE;
}
if ($content == "" && $user->rd_kalive_is_expired($this->curtime)) {
- $content = $user->stream_keepalive();
+ $content = $user->stream_keepalive(FALSE);
}
if ($content != "") {
$response = chunked_content($content);
return TRUE;
}
-function stream_keepalive()
+function stream_keepalive($with_ping)
{
return (sprintf("<script id='hs%d' type='text/javascript'><!--
-push(null);
+push(%s);
// -->
-</script>", $this->rd_scristp++));
+</script>", $this->rd_scristp++, ($with_ping ? "\"act_ping();\"" : "null")));
}
-function stream_ping()
+static function base_get()
{
- return (sprintf("<script id='hs%d' type='text/javascript'><!--
-push(\"act_ping();\");
-// -->
-</script>", $this->rd_scristp++));
-
+ $c = get_called_class();
+ printf("CALLED_CLASS: [%s]\n", $c);
+ return $c::BASE;
}
- static function base_get()
- {
- $c = get_called_class();
- printf("CALLED_CLASS: [%s]\n", $c);
- return $c::BASE;
- }
-
} // end class User