public function ping($payload = null)
    {
        if ($payload === null) {
            $payload = microtime(true);

        } elseif (isset($payload[125])) { //Much faster than strlen($payload) > 125
            throw new LengthException("Ping payload cannot be larger than 125 bytes");
        }

        $this->currentPingFrame = new DataFrame($this->logger);
        $this->currentPingFrame->setOpcode(DataFrame::OPCODE_PING);
        $this->currentPingFrame->setPayload($payload);
        $this->pushData($this->currentPingFrame);

        return $payload;
    }
public function ping($payload = null)
    {
        if ($payload === null) {
            $payload = microtime(true);

        } elseif (isset($payload[125])) { //Much faster than strlen($payload) > 125
            throw new LengthException("Ping payload cannot be larger than 125 bytes");
        }

        $this->currentPingFrame = new DataFrame($this->logger);
        $this->currentPingFrame->setOpcode(DataFrame::OPCODE_PING);
        $this->currentPingFrame->setPayload($payload);
        $this->pushData($this->currentPingFrame);

        return $payload;
    }
public function ping ( $ payload = null ) { if ( $ payload === null ) { $ payload = microtime ( true ) ; } elseif ( isset ( $ payload [ 125 ] ) ) { //Much faster than strlen($payload) > 125 throw new LengthException ( "Ping payload cannot be larger than 125 bytes" ) ; } $ this -> currentPingFrame = new DataFrame ( $ this -> logger ) ; $ this -> currentPingFrame -> setOpcode ( DataFrame :: OPCODE_PING ) ; $ this -> currentPingFrame -> setPayload ( $ payload ) ; $ this -> pushData ( $ this -> currentPingFrame ) ; return $ payload ; }
Sends "PING" frame to connected client.

@param mixed|null $payload Maximum of 125 bytes. If set to null current time will be used. It's possible to use
empty string.

@return string Used payload value
@throws LengthException In case of payload exceed 125 bytes.
Sends PING frame to connected client .