This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$buffer = ''; | |
$conn->on('data', function($data, $conn) use (&$buffer) { | |
$buffer .= $data; | |
// check to see if the buffer contains any line feeds (detect end of line) | |
while (false !== ($pos = strpos($buffer, PHP_EOL))) { | |
// get the first line from the buffer (up to the EOL) | |
$line = substr($buffer, 0, $pos); | |
// remove the line from the buffer (advance behind the EOL) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git clone https://github.com/reactphp/react source | |
cd source | |
# list all branches that should be preserved | |
# only version branches listed, as to skip WIP branches | |
git branch 0.3 origin/0.3 | |
git branch 0.4 origin/0.4 | |
#master is already included (default from clone) | |
# remove reference from origin to speed up rewriting its references |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class EnterpriseApi extends Clue\React\Soap\Proxy | |
{ | |
public function __call($method, $args) | |
{ | |
if (!in_array($method, array('DoAuthenticateUserWithPlaintextPassword', 'BypassTheAuthenticationFramework', 'debug'))) { | |
$d = new React\Promise\Deferred(); | |
$d->reject(new \Exception('This is an enterprise API!!11')); | |
return $d->promise(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use React\SocketClient\Connector; | |
use React\SocketClient\SecureConnector; | |
use React\Socket\Server; | |
use React\Stream\Stream; | |
require __DIR__ . '/../vendor/autoload.php'; | |
$loop = React\EventLoop\Factory::create(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Action: command | |
Command: sip show peers | |
Response: Follows | |
Privilege: Command | |
Name/username Host Dyn Forcerport ACL Port Status Description | |
100 (Unspecified) D a 0 UNKNOWN | |
111 (Unspecified) D a 0 UNKNOWN | |
1111 (Unspecified) D a 0 Unmonitored | |
114 (Unspecified) D a 0 UNKNOWN |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# active call from 50 -> 49 | |
Action: CoreShowChannels | |
Response: Success | |
EventList: start | |
Message: Channels will follow | |
Event: CoreShowChannel | |
Channel: SIP/49-1-00000011 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Action: pong | |
Response: Error | |
Message: Invalid/unknown command: pong. Use Action: ListCommands to show available commands. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Action:ping | |
Response: Success | |
Ping: Pong | |
Timestamp: 1403277378.612099 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt-get install rubygems | |
sudo gem install fpm | |
sudo apt-get install wget | |
wget http://lueck.tv/psocksd/psocksd.phar | |
chmod 755 psocksd.phar | |
fpm -s dir -t deb -n psocksd -v 0.3.1 -a all -d 'php5-cli > 5.3' --license MIT ./psocksd.phar=/usr/bin/psocksd | |
dpkg -c psocksd_0.3.1_all.deb | |
sudo dpkg -i psocksd_0.3.1_all.deb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$loop = React\EventLoop\Factory::create(); | |
$logger = new \Zend\Log\Logger(); | |
$writer = new \Zend\Log\Writer\Syslog(array('application' => 'movim')); | |
$logger->addWriter($writer); | |
$connector = new Ratchet\Client\Factory($loop); |