Questions tagged [reactphp]

React is a low-level library for event-driven programming in PHP.

Event-driven, non-blocking I/O with PHP. http://reactphp.org/ React is a low-level library for event-driven programming in PHP. At its core is an event loop, on top of which it provides low-level utilities, such as: Streams abstraction, async dns resolver, network client/server, http client/server, interaction with processes. Third-party libraries can use these components to create async network clients/servers and more.

The event loop is based on the reactor pattern (hence the name) and strongly inspired by libraries such as EventMachine (Ruby), Twisted (Python) and Node.js (V8).

172 questions
0
votes
1 answer

How to can I write php asynchroneous functions using reactphp

I thought I can do more at same time so I started with reactphp. The code runs so fine, but I wanted to be sure that the code was indeed asynchroneous I tried the code below which gave me no confidence, it echoed the strings 'in natural order' like…
smacaz
  • 148
  • 8
0
votes
1 answer

\React\Promise\all($promises) doesn't work as expected in ReactPHP

Please note that I've also created an issue on the related repo. In the documentation, it says that this function will return a promise which will resolved after all the promises in the array have resolved. Here is my implementation; private…
Süha Boncukçu
  • 913
  • 1
  • 10
  • 29
0
votes
1 answer

ReactPHP blocking process in wordpress plugin

i am trying to make a websocket server in my wordpress plugin. when i try to access the site it loads alot of time and outputs this iis error: The FastCGI process exceeded configured request timeout websocket server code: $loop =…
Neriya Rosner
  • 43
  • 1
  • 10
0
votes
2 answers

Syntax error in a promise before the promise is returned

Here's a simple event loop with a ReactPHP promise: new React\Http\Server([ function(ServerRequestInterface $request) { $deferred = new React\Promise\Deferred(); $promise = $deferred->promise(); $deferred->reject(new…
Daniel J F
  • 1,054
  • 2
  • 15
  • 29
0
votes
2 answers

ReactPHP get_class() expects parameter 1 to be object, string given

I am getting this error code: PHP Warning: get_class() expects parameter 1 to be object, string given in /phalcon/vendor/clue/block-react/src/functions.php on line 90 PHP Fatal error: Uncaught UnexpectedValueException: Promise rejected with…
Maarten Raaijmakers
  • 615
  • 2
  • 8
  • 20
0
votes
2 answers

RatchetPHP unable to send messages to all clients in loop

I'm using Ratchet PHP to send messages to clients, and I'm using $server->loop->addPeriodicTimer(1, function () use ($row, $server) {... To send a message every second. I can echo the message and the MySQL query works, but I am unable to actually…
0
votes
1 answer

Trouble stopping the foreach loop depend upon promises resolve or reject

$msg_sent = false; foreach ($channels as $channel) { $resolve = function() use ( &$msg_sent ) { $msg_sent = true; }; $reject = function( \Exception $e ) { error_log( $e, 3, './error.txt' . PHP_EOL ); }; …
user9936032
0
votes
3 answers

ReactPhp : create endless loop for checking sysfs modification

I would like to use this for monitoring sysfs GPIO input (/sys/class/gpio). But when I test the given code as example, the scripts finishes (no error) just after the $loop->run(). How can I make this loop permanent (endless one) ?
nbonniot
  • 1,034
  • 16
  • 33
0
votes
2 answers

Multiple function calls asynchronously in PHP

I'm using Symfony 3 and ReactPHP library for control all my functionality and I need to execute multiple calls to same function (subFunction() in code) asynchronously. I have 2 projects (project1 and project2): Project 1 code: /** * Loop an array of…
Wildchild
  • 233
  • 1
  • 6
  • 17
0
votes
1 answer

CentOs 6, Php7.1, libevent, nginx returns 502

I am upgrading laravel web application from php5.6 to php7.1 which leads me to upgrading libevent module. Application is async ans based on react library. So I ended with installed: PHP 7.1.12, libevent: 2.1.8 + expressif/pecl-event-libevent. And I…
0
votes
2 answers

How to process multiple requests using the same PHP running instance?

As we know, PHP works in the "share nothing" phylosophy. It therefore is bound with serious performance limitations. While a compiled script can be accelerated by some caching extensions we cannot avoid very heavy initialization (for example, we…
0
votes
1 answer

Use cakePHP and ReactPHP combination, is this possible?

Is it possible to run cakePHP application and reactPHP as its web-server? I heard a huge performance gain by using reactPHP. However, I have not seen anyone have leverage on existing matured PHP framework such as cake.
norrin
  • 171
  • 8
0
votes
0 answers

Unable to complete SSL/TLS handshake and set local cert chain file

I can create a ssl key and certificate with the following script: "US", "stateOrProvinceName" => "CA", "localityName" => "San Francisco", …
user1032531
  • 24,767
  • 68
  • 217
  • 387
0
votes
1 answer

Reactphp with symfony images and css

I am using reactphp with symfony my react webserver link is http://localserver.reactsymfony:1337/. none of css and images file serve. for example ( http://localserver.reactsymfony:1337/bundles/calibration/css/bootstrap.min.css ) it gives me 404 not…
0
votes
2 answers

Real-time Apps Symfony - What technology to use?

I would like to know if someone could explain to me how to build a real-time application with Symfony? I have looked at a lot of documentation with my best friend Google, but I have not found quite detailed articles. I would like some more…
Peter Artoung
  • 224
  • 5
  • 20