Ratchet: Immediately disconnecting after connection
I am trying to add a periodic timer to my WebSocket code. 

```
`
<?php

use Ratchet\Server\IoServer;
use Ratchet\Http\HttpServer;
use Ratchet\WebSocket\WsServer;
use MyApp\BetSocket;

require dirname( __FILE__ ) . '/vendor/autoload.php';

$dbConn = new MysqliDb("localhost", "root", "", "betball_game");

if( ! $dbConn ){
   echo 'Database Connection Failed.'; die;
}

$loop = React\EventLoop\Factory::create();
$socket = new \React\Socket\Server('127.0.0.1:8080', $loop);
$server = new \Ratchet\Server\IoServer(
    new BetSocket($dbConn, $loop), $socket, $loop
);
echo "Server::Running \n";
$server->run();

// $server = IoServer::factory(
//     new HttpServer(
//         new WsServer(
//             new BetSocket($dbConn)
//         )
//     ),
//     8080
// );
// echo "Server::Running \n";
// $server->run();
`
```
And BetSocket class code:

```
`
class BetSocket implements MessageComponentInterface {

    protected $db;
    protected $bet_state = "BET_IDLE";

    public function __construct($mysqli_conn, $loop)
    {
       $this->db = $mysqli_conn;
       $this->clients = new \SplObjectStorage;
       $this->players = new \SplObjectStorage;
       $loop->addPeriodicTimer(5, function (\React\EventLoop\Timer\Timer $timer) {
            echo "testing \n";
        });
    }
`
```

When I tried to connect to this WebSocket from my javascript client:
socket  = new WebSocket('ws://127.0.0.1:8080');
```
`
 onOpen
New connection: (42)
No of clients: (1)
onClose (42)
testing
testing
`
```
But the timer is running...

I am testing this application from my local machine. The client application is running on the XAMPP server. 

If I comment periodic timer code... then able to connect to WebSocket.

Not sure what IP I need to give here...
$socket = new \React\Socket\Server('127.0.0.1:8080', $loop);
In my exising code(which is working fine)... I didnot specify any IP address:
```
`
 $server = IoServer::factory(
     new HttpServer(
         new WsServer(
             new BetSocket($dbConn)
         )
     ),
     8080
 );
`
```

