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 connect wss via ReactPHP components

I have a URI that works well with a js implementation, built as: "wss://domain" When I want to implement a subscriber for this socket as below: $loop = Factory::create(); $connector = new Connector($loop); $promise =…
Süha Boncukçu
  • 913
  • 1
  • 10
  • 29
0
votes
1 answer

Use ReactPHP Socket to open a ws:// socket

I've been trying to get ReactPHP socket up and running for a bit now, once up, I can telnet to it on the specified port but I cannot use websocat or any js lib to connect via ws:// protocol. Any help would be appreciated. $loop =…
Farid Anthony
  • 11
  • 1
  • 1
0
votes
0 answers

How to insert a table name into data that is sent to front-end using axios?

I am fetching a data according to the table name, but I also need to send the table name to the front end along with the data. I have this code. $sql_fetchItems = "select * from `$cat`"; $result_fetchItems = mysqli_query($connection,…
Kyi Zin
  • 823
  • 1
  • 6
  • 15
0
votes
1 answer

ReactPhp deploying on Ubunutu 18.04

Hi I have working REST Api with ReactPHP on my local machine I want to deploy it on a dev server , I added a newsubdomain on DO, placed a conf with nginx, setup a ongoing process to php index.php my server root file for ReactPHP app. Allowed the…
Rajnish Mishra
  • 826
  • 5
  • 21
0
votes
1 answer

Uncaught Error: Class 'React\React\EventLoop\Factory' not found

When I run php server.php I get the following error: Fatal error: Uncaught Error: Class 'React\React\EventLoop\Factory' not found in C:\xampp\htdocs\socket\server.php:7 I used composer to grab composer require react/socket:^1.3 Require the…
whatsmyname
  • 11
  • 1
  • 5
0
votes
1 answer

Periodically send messages to specific clients in Ratchet using ReactPHP

General info Working on a chatsystem using Ratchet PHP. On request of my users, I'm trying to implement a Triviabot in a specific chatroom. Chatrooms don't actually "exist". Instead it checks which client ids are listed in an array and only sends…
icecub
  • 8,615
  • 6
  • 41
  • 70
0
votes
0 answers

Server side events with ReactPHP

I want to build a php script for server side events (SSE), that will notify connected clients about changes in the server-side data. For example, I have a CRUD API. When an API endpoint is called, it does its own stuff and then somehow notifies the…
user2531657
  • 339
  • 2
  • 9
0
votes
2 answers

How to send a message to ReactPHP/Amp/Swoole/etc. from PHP-FPM?

I'm thinking about making a worker script to handle async tasks on my server, using a framework such as ReactPHP, Amp or Swoole that would be running permanently as a service (I haven't made my choice between these frameworks yet, so solutions…
BenMorel
  • 34,448
  • 50
  • 182
  • 322
0
votes
1 answer

Should an existing ReactPHP loop be reused?

Should a single ReactPHP loop be used for multiple purposes as shown below, or should a new loop be created and used for each purpose? If reused, the loop is obviously already running, so how does one ensure it is not inadvertently executed before…
user1032531
  • 24,767
  • 68
  • 217
  • 387
0
votes
0 answers

listen to multiple TCP ports using ReactPHP socket

I am trying to start ReactPHP TCP sockets on a range of TCP ports (1000 to 2000). All the ports are open and I can see the connection established while testing using telnet but the sockets never fires the connection.on('data' ...) event. Using any…
user2576266
  • 2,383
  • 2
  • 16
  • 22
0
votes
0 answers

How to run a computation while running a websocket server in PHP?

I have the following scenario: I have an API built with the Slim PHP framework. I am using the PHP lib Ratchet to run a WebSocket server. Once the WebSocket server is started, I want to run a function that does some computation while the server is…
Neo_999
  • 151
  • 1
  • 1
  • 9
0
votes
1 answer

Ratchet Pawl: unable to send message to websocket in loop

I need to read data from a serial port and send it to a websocket. I loop into a while and when some data arrives I throw it out. Given the code below, which is a very little modification from Pawl's loop example, the send() is never executed and I…
Maxxer
  • 1,038
  • 1
  • 18
  • 37
0
votes
0 answers

How to monitor Mysql table changes by using ReactPHP

I would like to monitor every table changes in a MySql table, (insert, update, delete), using ReactPHP. Is it possible? If yes how I can do it?
0
votes
3 answers

How to load a CodeIgniter view in $promise->then() in a controller?

In my CodeIgniter 2 controller I call a model method which returns a ReactPHP promise, and I want to load a CodeIgniter view in the function called by that promise's ->then() method. How can I do this? What happens instead is the controller method…
timblack1
  • 137
  • 7
0
votes
2 answers

Q&A: How to get POST variables with PHP on Alibaba Cloud Function Compute service

I played around with the PHP 7.2 runtime and HTTP trigger on Alibaba Cloud Function Compute. The basic example in the documentation is the following: