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
1
vote
2 answers

ZeroMQ + ReactPHP: Multiple producers (push) and multiple consumers (pull)

I'm using reactphp/zmq. How can I have multiple push workers within multiple pull workers, is that possible? A only can have multi pull and single push, as in README's example: $push->connect() $pull->bind() Or single pull and multi…
Leo Cavalcante
  • 2,327
  • 2
  • 22
  • 30
1
vote
1 answer

React PHP timeout always resolves

I was playing around with React and wanted to try to get a working timeout function. Following (sort of) the examples and Unit tests from https://github.com/reactphp/promise-timer#timeout I came up with: use React\Promise\Timer; $promise =…
Robse
  • 853
  • 3
  • 14
  • 28
1
vote
1 answer

ReactPHP and Promises

I'm trying to understand the concept of Promises using ReactPHP $app = function ($request, $response) use ($redis, $config) { $promise = React\Promise\all( array( AsyncGetUser(), AsyncGetDB(), …
1
vote
0 answers

Listeners and timers in ReactPHP?

I'm trying to build a small application which will do a few things. A main class will spawn, destroy, listen to, and manage workers...
Allenph
  • 1,875
  • 27
  • 46
1
vote
1 answer

ReactPHP - Close disconnected connection

I am using ReactPHP for TCP listener component. This component listens for incoming connections and exchanges data with them. $connections array is updated as clients connect/disconnect from listener. $loop =…
1
vote
1 answer

ReactPHP/Socket server - set connection timeout

I have TCP Socket server using react\socket. Depending on received data from the client, it doing something, then it close connection with the client. The problem is i can't understand how to make connection timeout, if the server have not received…
J_z
  • 993
  • 1
  • 9
  • 18
1
vote
1 answer

ratchet event loop getting blocked

I creating a web socket connection using ratchet php. I connected a client and then executed a query(it will take around 20 sec to execute the query) in the mean time I try to connect another client and I see that the web socket connection is in…
Aks
  • 183
  • 2
  • 11
1
vote
1 answer

Calling a (Ratchet) WampServer method through a React Timer

I am setting up a WampServer with Ratchet. Is it possible to add to the loop a timer that calls a WampServer's method every 30 second? I have tried the following code: public function addMonitoringTimer(){ $this->loop->addPeriodicTimer(30,…
1
vote
1 answer

Possible to broadcast using ReactPHP?

Is it possible to broadcast or emit data over to browser and catch it with javascript to treat it accordingly, using ReactPHP without Ratchet? I have a periodicTimer on event-loop and sometimes it needs to broadcast or emit to users connected by a…
1
vote
1 answer

getting wss working with stunnel & ratchet

Running Apache v2.4, PHP v5.6 w/ php-fpm, on CentOS 7 So I'm trying to get wss working with stunnel & Ratchet. I've got Ratchet's Hello World (http://socketo.me/docs/hello-world) working successfully with the test code on non-ssl at port 8080. I can…
Zxurian
  • 139
  • 2
  • 9
1
vote
0 answers

PHP proc_open not receiving data from Go script

I'm currently using the ReactPHP Child-Process library (which uses proc_open()) to get data from a Go application in stream format. However, when I dump all input from stdout and stderr, I get nothing even though when I test it in bash I get output.…
cheese5505
  • 962
  • 5
  • 14
  • 30
1
vote
0 answers

CakePHP database session handler and reactive programming

Look at the following code: public function step1 (){ $this->Session->write('test.test', 1); sleep(10); } public function step2 () { if($this->Session->read('test.test')){ $this->response->body('Great'); }else{ …
Serginho
  • 7,291
  • 2
  • 27
  • 52
1
vote
1 answer

ReactPHP libevent and socket_pair throws error

I have a problem then I use ReactPHP event-loop with stream_socket_pair. With StreamSelect loop it works perfectly but then I try to use it with LibEvent extension I got unlimited stream of error: [warn] kevent: Bad file descriptor The minimal code…
Aurimas Niekis
  • 227
  • 1
  • 14
1
vote
1 answer

Reactphp can't get total data on stream

im using reactphp library , and im working with a device that sends packages in different sizes. My problem is when i get the data $stream->on('data', function ($data, React\Stream\ReadableStreamInterface $stream) { $this->respuesta .=…
1
vote
1 answer

Async PHP requests

So, I want to create an asynchronous web service in PHP. Why? Because I've a nice async front-end, but Chrome will block my requests if I have more than 6 active TCP connections. Of course I have read some similar questions like: Async requests in…
GuyT
  • 4,316
  • 2
  • 16
  • 30