I am using Ratchet with laravel 4.1. I trying to pass the ratchet variables to the laravel job queue, but it shows serialization of 'closure' error when the $self variable is passed to the job queue. I am using 'barryvdh/laravel-async-queue' as the queue driver.
$self = $this->repository;
Queue::push(function($job) use ($nom,$self)
The full code is give below:
public function onClose(ConnectionInterface $conn) {
try {
// The connection is closed, remove it, as we can no longer send it messages
//$this->clients->detach($conn);
$currClient = $this->repository->getClientByConnection($conn);
$nom = $currClient->getId();
$this->repository->removeClient($conn);
echo "Connection {$conn->resourceId} has disconnected\n";
//print_r($this->repository->getClientById($nom)->getId());
$self = $this->repository;
print_r($self);
Queue::push(function($job) use ($nom,$self)
{
Log::info($nom);
$job->delete();
});
}
catch (Exception $e) {
Log::error('Chat->onClose->'.$e->getMessage());
}
}
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community