PHPDaemon\Structures\StackCallbacks::push PHP Method

push() public method

Push callback to the bottom of stack
public push ( callable $cb ) : void
$cb callable Callback
return void
    public function push($cb)
    {
        parent::push(CallbackWrapper::wrap($cb));
    }

Usage Example

Exemplo n.º 1
0
 /**
  * Sends a frame.
  * @param  string $data Frame's data.
  * @param  integer $type Frame's type. See the constants.
  * @param  callback $cb Optional. Callback called when the frame is received by client.
  * @callback $cb ( )
  * @return boolean Success.
  */
 public function sendFrame($data, $type = 0x0, $cb = null)
 {
     if ($this->finished) {
         return false;
     }
     $this->framesBuffer[] = $data;
     if ($cb !== null) {
         $this->onWrite->push($cb);
     }
     $this->flush();
     return true;
 }
All Usage Examples Of PHPDaemon\Structures\StackCallbacks::push