public function next_frame($timeout = 0)
 {
     if ($this->debug) {
         PhpAmqpLib_Helper_MiscHelper::debug_msg("waiting for a new frame");
     }
     if (!empty($this->frame_queue)) {
         return array_shift($this->frame_queue);
     }
     return $this->connection->wait_channel($this->channel_id, $timeout);
 }