Closed LoSunny closed 2 years ago
This feature is not supported now.
Sorry, I'm new to PHP and I'm not sure about what do you mean by "this feature". My goal is using the redis pub/sub feature, I can listen/send notification in my browser with the help of socket.io, and using PHP as my backend. If that is the case, what should I do or start my research?
EDIT If I want to use this feature, what version should I downgrade to?
If you want to use redis try https://github.com/walkor/redis.
Run command composer require workerman/redis
to install it.
The codes like this .
require __DIR__ . '/vendor/autoload.php';
use Workerman\Worker;
use Workerman\Autoloader;
use PHPSocketIO\SocketIO;
use Clue\React\Redis\Factory;
use Clue\React\Redis\Client;
$io = new SocketIO(8080);
$io->on('connection', function ($socket) {
});
$io->on('workerStart', function () {
global $redis;
$redis = new Client('redis://127.0.0.1:6379');
$redis->subscribe(['news', 'blog'], function ($channel, $message) {
echo "$channel, $message"; // news, news content
});
});
Worker::runAll();
Thank you, it works WHEN unused dependency are removed. 😆
I have tried to follow the instructions listed in #227, however the code is no longer working. My
composer.json
Part of my
index.php
Error