123456789101112131415161718192021 |
- <?php
- go(function () {
- $redis = new Swoole\Coroutine\Redis();
- $ret = $redis->connect('192.168.1.220', 6379);
- $msg = $redis->subscribe(['refill']);
- while (true)
- {
- $msg = $redis->recv(60);
- var_dump($msg);
- $redis->close();
- if(empty($msg)) continue;
- if(count($msg) !== 3) continue;
- $channel = $msg[1];
- $content = unserialize($msg[2]);
- $type = $content['type'];
- $val = $content['value'];
- }
- });
|