#!/usr/bin/env php
<?php
/**
 * Copyright (c) Yves Piquel (http://www.havokinspiration.fr)
 *
 * Licensed under The MIT License
 * Redistributions of files must retain the above copyright notice.
 *
 * @copyright     Copyright (c) Yves Piquel (http://www.havokinspiration.fr)
 * @link          http://github.com/elephfront/robo-live-reload
 * @license       http://www.opensource.org/licenses/mit-license.php MIT License
 */
declare(strict_types=1);
require 'vendor/autoload.php';

use Ratchet\Http\HttpServer;
use Ratchet\Server\IoServer;
use Elephfront\RoboLiveReload\LiveReloadMessager;

$ws = new \Ratchet\WebSocket\WsServer(new LiveReloadMessager());
$ws->disableVersion(0);

$argv = $_SERVER['argv'];

$server = IoServer::factory(new HttpServer($ws), $argv[2], $argv[1]);
$server->run();