1
0
mirror of https://github.com/pattern-lab/patternlab-php.git synced 2025-02-19 23:14:38 +01:00

updating the web socket server server starter-uppers

This commit is contained in:
Dave Olsen 2014-01-20 13:04:17 -05:00
parent 17eb131bfa
commit ffb6442ef7
2 changed files with 21 additions and 27 deletions

View File

@ -1,7 +1,7 @@
<?php <?php
/*! /*!
* Content Sync Server, v0.1 * Auto-Reload Server, v0.2
* *
* Copyright (c) 2013-2014 Dave Olsen, http://dmolsen.com * Copyright (c) 2013-2014 Dave Olsen, http://dmolsen.com
* Licensed under the MIT license * Licensed under the MIT license
@ -11,15 +11,12 @@
* *
*/ */
// turn errors on or off for debugging purposes // auto-load classes
ini_set('display_errors', 0); require(__DIR__."/lib/SplClassLoader.php");
error_reporting(E_ALL);
require(__DIR__.'/lib/SplClassLoader.php');
// load wrench // load wrench
$classLoader = new SplClassLoader('Wrench',__DIR__.'/lib'); $loader = new SplClassLoader('Wrench', __DIR__.'/lib');
$classLoader->register(); $loader->register();
// parse the main config for the content sync port // parse the main config for the content sync port
if (!($config = @parse_ini_file(__DIR__."/../config/config.ini"))) { if (!($config = @parse_ini_file(__DIR__."/../config/config.ini"))) {
@ -27,18 +24,17 @@ if (!($config = @parse_ini_file(__DIR__."/../config/config.ini"))) {
exit; exit;
} }
$port = ($config) ? trim($config['contentSyncPort']) : '8002'; // give it a default port
$port = ($config) ? trim($config['autoReloadPort']) : '8001';
// start the content sync server $args = getopt("s");
$server = new \Wrench\Server('ws://0.0.0.0:'.$port.'/', array());
// register the application
$args = getopt("s");
$newlines = (isset($args["s"])) ? true : false; $newlines = (isset($args["s"])) ? true : false;
$server->registerApplication('contentsync', new \Wrench\Application\contentSyncBroadcasterApplication($newlines)); // start the content sync server
$server = new \Wrench\Server('ws://0.0.0.0:'.$port.'/', array());
// register the application
$server->registerApplication('autoreload', new \Wrench\Application\AutoReloadApplication($newlines));
$args = getopt("s");
if (!isset($args["s"])) { if (!isset($args["s"])) {
print "\n"; print "\n";
print "Auto-reload Server Started...\n"; print "Auto-reload Server Started...\n";

View File

@ -1,7 +1,7 @@
<?php <?php
/*! /*!
* Nav Sync Server, v0.1 * Page Follow Server, v0.2
* *
* Copyright (c) 2013-2014 Dave Olsen, http://dmolsen.com * Copyright (c) 2013-2014 Dave Olsen, http://dmolsen.com
* Licensed under the MIT license * Licensed under the MIT license
@ -11,15 +11,12 @@
* *
*/ */
// turn errors on or off for debugging purposes // auto-load classes
ini_set('display_errors', 0); require(__DIR__."/lib/SplClassLoader.php");
error_reporting(E_ALL);
require(__DIR__.'/lib/SplClassLoader.php');
// load wrench // load wrench
$classLoader = new SplClassLoader('Wrench',__DIR__.'/lib'); $loader = new SplClassLoader('Wrench', __DIR__.'/lib');
$classLoader->register(); $loader->register();
// parse the main config for the content sync port // parse the main config for the content sync port
if (!($config = @parse_ini_file(__DIR__."/../config/config.ini"))) { if (!($config = @parse_ini_file(__DIR__."/../config/config.ini"))) {
@ -27,13 +24,14 @@ if (!($config = @parse_ini_file(__DIR__."/../config/config.ini"))) {
exit; exit;
} }
$port = ($config) ? trim($config['navSyncPort']) : '8000'; // give it a default port
$port = ($config) ? trim($config['pageFollowPort']) : '8000';
// start the content sync server // start the content sync server
$server = new \Wrench\Server('ws://0.0.0.0:'.$port.'/', array()); $server = new \Wrench\Server('ws://0.0.0.0:'.$port.'/', array());
// register the application & run it // register the application & run it
$server->registerApplication('navsync', new \Wrench\Application\navSyncBroadcasterApplication()); $server->registerApplication('pagefollow', new \Wrench\Application\PageFollowApplication());
print "\n"; print "\n";
print "Page Follow Server Started...\n"; print "Page Follow Server Started...\n";