Slides online: https://speakerdeck.com/clue/getting-started-with-reactphp-pushing-real-time-data-to-the-browser-phpyorkshire Event info: https://www.meetup.com/de-DE/phpugms/events/vqvhmlyxkbwb/
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 | |
var_dump(array_rand(array()) === null); |
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
host:~$ redis-server --version | |
Redis server v=2.6.13 sha=00000000:0 malloc=jemalloc-3.3.1 bits=64 | |
host:~$ echo "port 1338" | redis-server - | |
host:~$ redis-benchmark -p 1338 -q | |
PING_INLINE: 156250.00 requests per second | |
PING_BULK: 185185.19 requests per second | |
SET: 192307.69 requests per second | |
GET: 188679.25 requests per second | |
INCR: 192307.69 requests per second | |
LPUSH: 200000.00 requests per second |
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 | |
namespace React\SocketClient; | |
use React\SocketClient\ConnectorInterface; | |
use React\EventLoop\LoopInterface; | |
use React\Promise\Timer; | |
class TimeoutConnector implements ConnectorInterface | |
{ |
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
$retry = function ($request, $next) { | |
return $next($request)->then(null, function ($error) use ($request, $next) { | |
// the $next failed. discard $error and retry once again: | |
return $next($request); | |
}); | |
}; | |
$runner = new MiddlewareRunner(array( | |
$retry, | |
function ($request, $next) { |
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(); | |
$loop->addSignal(SIGINT, function () use ($loop) { | |
echo 'CTRL+C caught'; | |
// cleanup... | |
// cleanup... | |
$loop->removeSignal(SIGINT); | |
}); |
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
C:\Users\lappy>ipconfig /all | |
Windows IP Configuration | |
Host Name . . . . . . . . . . . . : lappy-PC | |
Primary Dns Suffix . . . . . . . : | |
Node Type . . . . . . . . . . . . : Hybrid | |
IP Routing Enabled. . . . . . . . : No | |
WINS Proxy Enabled. . . . . . . . : No |
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 | |
namespace React\Socket; | |
use Evenement\EventEmitter; | |
use React\EventLoop\LoopInterface; | |
use InvalidArgumentException; | |
use RuntimeException; | |
final class FdServer extends EventEmitter implements ServerInterface |
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 | |
namespace Clue\React\Foo; | |
use Evenement\EventEmitter; | |
use React\Stream\ReadableStreamInterface; | |
use React\Stream\WritableStreamInterface; | |
use React\Stream\Util; | |
class MagicBytesSplitter extends EventEmitter implements ReadableStreamInterface |