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
2
votes
0 answers

Session handling with ReactPHP

I'm planning to run my existing Zend Framework 2 application using ReactPHP and so far it's going well, but I have troubles with sessions handling. So far I'm using this ReactPHP module for ZF2 which is letting me run my project very easy. I guess…
2
votes
1 answer

React warning "stream_select(): cannot represent a stream of type ZMQ_FD as a select()able descriptor"

I'm trying to use Ratchet for the first time and am following the push tutorial. I have the following code in push-server.php: namespace app\ratchet; require_once(__DIR__ . '/../common_functions.php'); // my autoloader require __DIR__ .…
Nate
  • 26,164
  • 34
  • 130
  • 214
1
vote
1 answer

How do use Guzzle 7 fully asynchronously with ReactPHP event loop without blocking for I/O?

I have a DiscordPHP bot that I'm trying to download some web pages that require a cookie. It seems I need to use a curl handler with Guzzle because the ReactPHP http browser doesn't support cookies. I've created this minimal script: use…
James Risner
  • 5,451
  • 11
  • 25
  • 47
1
vote
2 answers

React php connecting with a different port

I have two files opening a new socket and want them to connect to each other using React PHP. The following two files are the sockets: First file test1.php
1
vote
0 answers

Use libuv to act on a module poll

I wrote a Linux module with a .poll and want to use libuv to read the signal. This is in the poll function called by file_operations unsigned int mask = 0; poll_wait (file, &read_waitq, wait ); if (convert_finish_flag) mask |= POLLIN |…
varta
  • 3,296
  • 1
  • 17
  • 18
1
vote
1 answer

ReactPHP FileSystem - No supported adapter found for this installation

I'm trying to run this simple code on both PHP 7 and 8: $loop = \React\EventLoop\Factory::create(); $filesystem = \React\Filesystem\Filesystem::create($loop); $file = $filesystem->file('test.txt'); $file->getContents()->then(function ($contents) { …
iTaMaR
  • 189
  • 2
  • 10
1
vote
1 answer

ReactPHP --> File upload --> $request->getUploadedFiles() returns empty array

I'm learning ReactPHP with the Book «ReactPHP for Beginners». Everything worked fine, but now I'm on the section with file uploads. There is a simple html form:
Christian
  • 11
  • 1
1
vote
1 answer

Shutdown server after sending a response in ReactPHP

I was wondering, how can I shutdown a reactPHP HTTP server after a sending a response. Currently I have a server code like this: $loop = Factory::create(); $server = new Server($loop, function (ServerRequestInterface $request) { …
Eddy
  • 593
  • 8
  • 22
1
vote
0 answers

Create reactphp socket for push notification in laravel

I want to use reactphp socket for push notifications in laravel but I do not know what to do? route: Route::get('/test', function () { event(new testEvent($test)); }); event: public $test; public function __construct($test) …
Parsa Haghighi
  • 205
  • 1
  • 3
  • 13
1
vote
1 answer

Resize pseudo tty allocated by php

I am trying to develop a web console using php and xterm.js, I managed to get the pseudo tty allocated and attach it to xterm.js via websocket but I am not able to tell the process what is the size of terminal to make it work correctly with the…
0nepeop1e
  • 137
  • 7
1
vote
1 answer

Long polling telegram with ReactPHP async

I'm trying to do long polling with reactphp. I have a function getNotifications that stay in long polling waiting a response from Telegram. This telegram api can hold the request open until timeout or can send a response before the end of the…
1
vote
1 answer

ReactPHP how can I get requested URL into a variable?

I need to parse some information from a bunch of sites and I have to have URLs from which I get the content. I use this library https://github.com/clue/reactphp-buzz . In this exsample i use only one URL. How can i get the URL which i send a request…
Ruffin
  • 13
  • 4
1
vote
2 answers

Are there limitations in mysqli that make it unsuitable for use with AMP or ReactPHP?

I've seen that libraries such as amphp/mysql and friends-of-reactphp/mysql implement the low-level MySQL protocol, and do not rely on any built-in extension. Given that mysqli supports async queries, is there any reason why these async libraries…
BenMorel
  • 34,448
  • 50
  • 182
  • 322
1
vote
2 answers

How to run WebSocket and HTTP Server on the same port using ReactPHP and Ratchet?

I've the following code: use Ratchet\Http\HttpServer; use Ratchet\WebSocket\WsServer; $loop = \React\EventLoop\Factory::create(); $socketServer = new \React\Socket\Server('127.0.0.1:8080', $loop); $httpServer = new…
Malik Naik
  • 1,472
  • 14
  • 16
1
vote
0 answers

ReactPHP QueryResult Optimization?

I would like to know if the result of QueryResult is efficient and use well because I just used this lib and I don't know it too well and I would like to know if I respected the code by defining the resultRows response with $data in the callable and…