implementing websocket server without zeromq and WAMP and send push message to it by server
I want to implement a websocket server without zeromq and WAMP, 
and send message to websocket from inside server.

first I executed _server.php_ file. When it is executed it waits for incomming connections.
then I executed _msgToWS.php_ file. When it executed, it should be connected to the _websocket server_ and send the message to it and then close. but When it is executed it waits infinitely !!

please help me to find out whats the problem ?

this is my scripts:
**server.php** (from [here](http://socketo.me/docs/hello-world))
```
use Ratchet\Server\IoServer;
use Ratchet\Http\HttpServer;
use Ratchet\WebSocket\WsServer;

    require __DIR__ . '/libs/vendor/autoload.php';
    require __DIR__ . '/chat.php';

	$server = IoServer::factory(
        new HttpServer(
            new WsServer(
                new chat()
            )
        ),
        8080
    );

    $server->run();
```
**chat.php** (from [here](http://socketo.me/docs/hello-world))
```

use Ratchet\MessageComponentInterface;
use Ratchet\ConnectionInterface;

class chat implements MessageComponentInterface {
    
	protected $clients;

    public function __construct() {
        $this->clients = new \SplObjectStorage;
    }
	
	public function onOpen(ConnectionInterface $conn) {
		
		$this->clients->attach($conn);

        echo "New connection! ({$conn->resourceId})\n";
    }

    public function onMessage(ConnectionInterface $from, $msg) {
		$numRecv = count($this->clients) - 1;
        echo sprintf('Connection %d sending message "%s" to %d other connection%s' . "\n"
            , $from->resourceId, $msg, $numRecv, $numRecv == 1 ? '' : 's');

        foreach ($this->clients as $client) {
            if ($from !== $client) {
                // The sender is not the receiver, send to each client connected
                $client->send($msg);
            }
        }
    }

    public function onClose(ConnectionInterface $conn) {
		$this->clients->detach($conn);

        echo "Connection {$conn->resourceId} has disconnected\n";
    }

    public function onError(ConnectionInterface $conn, \Exception $e) {
		
		echo "An error has occurred: {$e->getMessage()}\n";

        $conn->close();
    }
}
```
**msgToWS.php** (from [here](https://github.com/ratchetphp/Ratchet/issues/433#issuecomment-222473388))
```
require __DIR__ . '/libs/vendor/autoload.php';
	
	
	
	function pawlConnect($msg) {
        $loop = \React\EventLoop\Factory::create();
        $connector = new \Ratchet\Client\Connector($loop);

        $connector('ws://127.0.0.1:8080', [], ['Origin' => 'origin'])
        ->then(function(\Ratchet\Client\WebSocket $conn) use ($msg) {

            $conn->on('close', function($code = null, $reason = null) {
                echo "Connection closed ({$code} - {$reason})\n";
            });

            $conn->send($msg);
            $conn->close();

        }, function(\Exception $e) use ($loop) {
            echo "Could not connect: {$e->getMessage()}\n";
            $loop->stop();
        });

        $loop->run();
    }

	$msg = array("content" => "hi to all");
	pawlConnect(json_encode($msg));
```