Permalink
Browse files

initial commit

  • Loading branch information...
0 parents commit dcd4fc102723b0812a66e88f6e430a4eea96b60b @juzna committed Feb 18, 2011
22 README
@@ -0,0 +1,22 @@
+LiveConnect is set of tools, with which you can make live forms or tables easily.
+"Live" means that if someone changes the same entity, which you are just editing,
+you will see a notification. Or, when having a table displayed in your browser while
+someone else adds a new row into that table, you will get immediate response
+in updating that table. These are some examples, how LiveConnect can work.
+However, LiveConnect is a general tool for any features like this.
+
+LiveConnect is based on these libraries:
+ - Nette + Doctrine 2 ORM in PHP application
+ - Node.js as event subscriber and notifier
+ - jQuery + jQuery UI on client side
+ - Socket.IO for communication between client and server
+
+
+LiveConnect consists of these parts:
+ ....TODO: write more doc
+
+
+Dependancies:
+ - ActiveEntity from https://github.com/juzna/iManaJUZment/tree/56fc2e0542cee2fc81d28fe961de4fdfc5433d0a/app/classes/ActiveEntity
+
+
@@ -0,0 +1,26 @@
+<?php
+/**
+* Basic initializer for all daemons
+*/
+
+// absolute filesystem path to the application root
+define('APP_DIR', realpath(__DIR__ . '/../app/'));
+define('LIBS_DIR', realpath(APP_DIR . '/../libs/'));
+define('TMP_DIR', realpath(APP_DIR . '/../temp/'));
+define('LOG_DIR', realpath(APP_DIR . '/../log/'));
+
+require_once __DIR__ . '/common.php';
+
+// Flush automatically
+ob_implicit_flush(true);
+
+// Load Nette framweork
+require_once(LIBS_DIR . '/Nette/loader.php');
+
+use Nette\Environment;
+Nette\Debug::enable();
+Environment::loadConfig();
+
+// Load Doctrine as well
+if(isset($wantDoctrine) && $wantDoctrine) require_once APP_DIR . '/bootstrap-doctrine.php';
+
@@ -0,0 +1,16 @@
+<?php
+
+function runUnixSocketServer($name, $processor) {
+ // Create server on socket
+ $unixPath = TMP_DIR . '/sock/' . $name;
+ @unlink($unixPath);
+ if(!is_dir($socketDir = dirname($unixPath))) mkdir($socketDir, 0777);
+
+ $socket = new TServerSocket("unix://$unixPath", -1);
+ $socket->listen();
+ while(true) {
+ $socket->select($processor);
+ echo "."; flush();
+ }
+}
+
@@ -0,0 +1,26 @@
+#!/usr/bin/php
+<?php
+/**
+* Send an event to LiveConnect server
+*/
+
+@list(, $userId, $table, $op) = $_SERVER['argv'];
+if(!isset($table)) die("Please pass arguments: user, table, operation!\n");
+
+require_once(__DIR__ . '/../bootstrap.php');
+$unixPath = TMP_DIR . '/sock/nagios-notify';
+
+$socket = new TSocket('localhost', 9090);
+//$transport = new TBufferedTransport($socket, 1024, 1024);
+$transport = new TFramedTransport($socket);
+$protocol = new TBinaryProtocol($transport, false, false);
+$client = new /*\Thrift\LiveConnect\*/LiveConnectClient($protocol);
+
+$oldData = array('name' => 'John');
+$newData = array('name' => 'Simon');
+
+$transport->open();
+$client->notify($userId, $table, $op, $oldData, $newData);
+$transport->close();
+
+echo "Message sent\n";
Oops, something went wrong.

0 comments on commit dcd4fc1

Please sign in to comment.