public function sendCommand($commandName, $payload, $cb = null)
    {

        $pct = implode(
            static::ARGS_DELIMITER,
            array_map(function ($item) {
                return !is_scalar($item) ? serialize($item) : $item;
            }, (array)$payload)
        );
        $this->onResponse->push($cb);
        $this->write(
            pack(
                static::HEADER_WRITE_FORMAT,
                static::MAGIC_REQUEST,
                $this->requestCommandList[$commandName],
                mb_orig_strlen($pct)
            )
        );
        $this->write($pct);
    }
public function sendCommand($commandName, $payload, $cb = null)
    {

        $pct = implode(
            static::ARGS_DELIMITER,
            array_map(function ($item) {
                return !is_scalar($item) ? serialize($item) : $item;
            }, (array)$payload)
        );
        $this->onResponse->push($cb);
        $this->write(
            pack(
                static::HEADER_WRITE_FORMAT,
                static::MAGIC_REQUEST,
                $this->requestCommandList[$commandName],
                mb_orig_strlen($pct)
            )
        );
        $this->write($pct);
    }
public function sendCommand ( $ commandName , $ payload , $ cb = null ) { $ pct = implode ( static :: ARGS_DELIMITER , array_map ( function ( $ item ) { return ! is_scalar ( $ item ) ? serialize ( $ item ) : $ item ; } , ( array ) $ payload ) ) ; $ this -> onResponse -> push ( $ cb ) ; $ this -> write ( pack ( static :: HEADER_WRITE_FORMAT , static :: MAGIC_REQUEST , $ this -> requestCommandList [ $ commandName ] , mb_orig_strlen ( $ pct ) ) ) ; $ this -> write ( $ pct ) ; }
Send a command

@param $commandName
@param $payload
@param callable $cb = null
Send a command