WebSocket with Laravel 5.2
<p>I'm doing a aplication in Laravel 5.2 that uses websockets. For the websocket connection I'm using <a href="https://github.com/hoaproject/Websocket" rel="nofollow">HoaServer</a>, wich works very well.</p>

<p>The bad part is, I do not know how to make this server as a controller, or at least have acess to my models, right now I'm using a separeted PDO connection to make the DB querys.</p>

<p>Someone knows if it is possible to make this server as a controller or at least have acess to the database throught laravel models?</p>

<p>My server right now:</p>

<pre><code>require_once(__DIR__.'/../vendor/autoload.php');

$PDO = new PDO('mysql:host=127.0.0.1:3306;dbname=DBNAME', "USER", "PASS");

$websocket = new Hoa\Websocket\Server(new Hoa\Socket\Server('ws://'.$ip.':'.$porta));

$websocket-&gt;on('open', function (Hoa\Event\Bucket $bucket) {
    return;
});

$websocket-&gt;on('message', function (Hoa\Event\Bucket $bucket) {
    return;
});

$websocket-&gt;on('close', function (Hoa\Event\Bucket $bucket) {
    return;
});

$websocket-&gt;run();
</code></pre>

<p>The closest that I fond was to fire an <a href="https://laracasts.com/discuss/channels/tips/hoawebsocket-with-laravel-5-projects-push-notifications?page=1" rel="nofollow">laravel event</a>, that I do not know how. :/</p>

<pre><code>//Socket server message event
$server-&gt;on('message', function() {
     //Fire your Laravel Event here
});
</code></pre>