|
|
@ -28,7 +28,7 @@ $connector($config->websocketurl, array('xmpp'))->then(function($conn) use (&$st |
|
|
|
|
|
|
|
$conn->on('message', function($message) use ($conn, $loop) { |
|
|
|
if($message != '') { |
|
|
|
fwrite(STDERR, colorize($message, 'yellow')." : ".colorize('received', 'green')."\n"); |
|
|
|
//fwrite(STDERR, colorize($message, 'yellow')." : ".colorize('received', 'green')."\n");
|
|
|
|
|
|
|
|
if($message == '</stream:stream>') { |
|
|
|
$conn->close(); |
|
|
@ -48,12 +48,12 @@ $connector($config->websocketurl, array('xmpp'))->then(function($conn) use (&$st |
|
|
|
|
|
|
|
if(!empty($msg)) { |
|
|
|
$msg = json_encode($msg); |
|
|
|
fwrite(STDERR, colorize($msg, 'yellow')." : ".colorize('sent to browser', 'green')."\n"); |
|
|
|
//fwrite(STDERR, colorize($msg, 'yellow')." : ".colorize('sent to browser', 'green')."\n");
|
|
|
|
echo base64_encode(gzcompress($msg, 9))."END"; |
|
|
|
} |
|
|
|
|
|
|
|
if(!empty($xml)) { |
|
|
|
fwrite(STDERR, colorize(trim($xml), 'yellow')." : ".colorize('sent to XMPP', 'green')."\n"); |
|
|
|
//fwrite(STDERR, colorize(trim($xml), 'yellow')." : ".colorize('sent to XMPP', 'green')."\n");
|
|
|
|
$conn->send(trim($xml)); |
|
|
|
} |
|
|
|
} |
|
|
@ -75,7 +75,7 @@ $connector($config->websocketurl, array('xmpp'))->then(function($conn) use (&$st |
|
|
|
$buffer = ''; |
|
|
|
|
|
|
|
foreach ($messages as $message) { |
|
|
|
fwrite(STDERR, colorize($message, 'yellow')." : ".colorize('received from the browser', 'green')."\n"); |
|
|
|
//fwrite(STDERR, colorize($message, 'yellow')." : ".colorize('received from the browser', 'green')."\n");
|
|
|
|
|
|
|
|
$msg = json_decode($message); |
|
|
|
|
|
|
@ -95,7 +95,7 @@ $connector($config->websocketurl, array('xmpp'))->then(function($conn) use (&$st |
|
|
|
\Moxl\API::clear(); |
|
|
|
|
|
|
|
if(!empty($xml)) { |
|
|
|
fwrite(STDERR, colorize(trim($xml), 'yellow')." : ".colorize('sent to XMPP', 'green')."\n"); |
|
|
|
//fwrite(STDERR, colorize(trim($xml), 'yellow')." : ".colorize('sent to XMPP', 'green')."\n");
|
|
|
|
$conn->send(trim($xml)); |
|
|
|
} |
|
|
|
|
|
|
@ -103,7 +103,7 @@ $connector($config->websocketurl, array('xmpp'))->then(function($conn) use (&$st |
|
|
|
\RPC::clear(); |
|
|
|
|
|
|
|
if(!empty($msg)) { |
|
|
|
fwrite(STDERR, colorize($msg, 'yellow')." : ".colorize('sent to the browser', 'green')."\n"); |
|
|
|
//fwrite(STDERR, colorize($msg, 'yellow')." : ".colorize('sent to the browser', 'green')."\n");
|
|
|
|
echo base64_encode(gzcompress($msg, 9))."END"; |
|
|
|
} |
|
|
|
} |
|
|
|