protected function writeApnStream($apnURL, $payload)
    {
        // Get the correct Apn stream and send data
        $fp = $this->getApnStream($apnURL);
        $response = (strlen($payload) === @fwrite($fp, $payload, strlen($payload)));

        // Check if there is responsedata to read
        $readStreams = array($fp);
        $null = NULL;
        $streamsReadyToRead = @stream_select($readStreams, $null, $null, 1, 0);
        if ($streamsReadyToRead > 0) {
            // Unpack error response data and set as the result
            $response = @unpack("Ccommand/Cstatus/Nidentifier", fread($fp, 6));
            $this->closeApnStream($apnURL);
        }

        // Will contain true if writing succeeded and no error is returned yet
        return $response;
    }
protected function writeApnStream($apnURL, $payload)
    {
        // Get the correct Apn stream and send data
        $fp = $this->getApnStream($apnURL);
        $response = (strlen($payload) === @fwrite($fp, $payload, strlen($payload)));

        // Check if there is responsedata to read
        $readStreams = array($fp);
        $null = NULL;
        $streamsReadyToRead = @stream_select($readStreams, $null, $null, 1, 0);
        if ($streamsReadyToRead > 0) {
            // Unpack error response data and set as the result
            $response = @unpack("Ccommand/Cstatus/Nidentifier", fread($fp, 6));
            $this->closeApnStream($apnURL);
        }

        // Will contain true if writing succeeded and no error is returned yet
        return $response;
    }
protected function writeApnStream ( $ apnURL , $ payload ) { // Get the correct Apn stream and send data $ fp = $ this -> getApnStream ( $ apnURL ) ; $ response = ( strlen ( $ payload ) === @ fwrite ( $ fp , $ payload , strlen ( $ payload ) ) ) ; // Check if there is responsedata to read $ readStreams = array ( $ fp ) ; $ null = NULL ; $ streamsReadyToRead = @ stream_select ( $ readStreams , $ null , $ null , 1 , 0 ) ; if ( $ streamsReadyToRead > 0 ) { // Unpack error response data and set as the result $ response = @ unpack ( "Ccommand/Cstatus/Nidentifier" , fread ( $ fp , 6 ) ) ; $ this -> closeApnStream ( $ apnURL ) ; } // Will contain true if writing succeeded and no error is returned yet return $ response ; }
Write data to the apn stream that is associated with the given apn URL

@param  string            $apnURL
@param  string            $payload
@throws \RuntimeException
@return mixed
Write data to the apn stream that is associated with the given apn URL