Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

missing file

  • Loading branch information...
commit 9df8a916e02fc75b559f61b03faa0b17e928470f 1 parent 27e9549
@gonzalo123 authored
Showing with 17 additions and 4 deletions.
  1. +4 −4 NovComet.php
  2. +13 −0 comet.php
View
8 NovComet.php
@@ -18,7 +18,7 @@ class NovComet {
private $_ids = array();
private $_callback = null;
- public function __construct($tries = 20, $sleep = 2)
+ public function __construct($tries = 10, $sleep = 2)
{
$this->_tries = $tries;
$this->_sleep = $sleep;
@@ -47,7 +47,7 @@ public function setCallbackCheck($callback)
const DEFAULT_COMET_PATH = "/dev/shm/%s.comet";
public function run() {
- if (is_null($callback)) {
+ if (is_null($this->_callback)) {
$defaultCometPAth = self::DEFAULT_COMET_PATH;
$callback = function($id) use ($defaultCometPAth) {
$cometFile = sprintf($defaultCometPAth, $id);
@@ -56,7 +56,7 @@ public function run() {
} else {
$callback = $this->_callback;
}
-
+ $out = array();
for ($i = 0; $i < $this->_tries; $i++) {
foreach ($this->_vars as $id => $timestamp) {
if ((integer) $timestamp == 0) {
@@ -80,4 +80,4 @@ public function publish($id)
{
return json_encode(touch(sprintf(self::DEFAULT_COMET_PATH, $id)));
}
-}
+}
View
13 comet.php
@@ -0,0 +1,13 @@
+<?php
+include('NovComet.php');
+
+$comet = new NovComet();
+$publish = filter_input(INPUT_GET, 'publish', FILTER_SANITIZE_STRING);
+if ($publish != '') {
+ echo $comet->publish($publish);
+} else {
+ foreach (filter_var_array($_GET['subscribed'], FILTER_SANITIZE_NUMBER_INT) as $key => $value) {
+ $comet->setVar($key, $value);
+ }
+ echo $comet->run();
+}
Please sign in to comment.
Something went wrong with that request. Please try again.