forked from pattern-lab/patternlab-php
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnavSyncBroadcasterServer.php
More file actions
executable file
·42 lines (32 loc) · 1.13 KB
/
navSyncBroadcasterServer.php
File metadata and controls
executable file
·42 lines (32 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
/*!
* Nav Sync Server, v0.1
*
* Copyright (c) 2013 Dave Olsen, http://dmolsen.com
* Licensed under the MIT license
*
* The server that clients attach to to learn about page updates. See
* lib/Wrench/Application/navSyncBroadcasterApplication.php for logic
*
*/
// turn errors on or off for debugging purposes
ini_set('display_errors', 0);
error_reporting(E_ALL);
require(__DIR__.'/lib/SplClassLoader.php');
// load wrench
$classLoader = new SplClassLoader('Wrench',__DIR__.'/lib');
$classLoader->register();
// parse the main config for the content sync port
if (!($config = @parse_ini_file(__DIR__."/../config/config.ini"))) {
print "Missing the configuration file. Please build it using the Pattern Lab builder.\n";
exit;
}
$port = ($config) ? trim($config['navSyncPort']) : '8000';
// start the content sync server
$server = new \Wrench\Server('ws://0.0.0.0:'.$port.'/', array());
// register the application & run it
$server->registerApplication('navsync', new \Wrench\Application\navSyncBroadcasterApplication());
print "\n";
print "Page Follow Server Started...\n";
print "Use CTRL+C to stop this service...\n";
$server->run();