nicolasff/phpredis — Issue #82: Inside the subscribe-callback function does not work access to DB by another connection
Author: Horzerus
Created: 2011-11-16 10:01:34+00:00
State: open

I want client-script to save data in DB and then invoke (call) to publish() function. And server script should use these data from DB to process the incoming message.
But inside the callback function does not work use the command to access another DB connection.

server.php file:

```php
hGet("h1", "foo")); // Always returns false :(
}

$redis1 = new Redis();
$redis1->pconnect('127.0.0.1', 6379);

$redis2 = new Redis();
$redis2->pconnect('127.0.0.1', 6379);

$redis1->subscribe(array('c1'), 'callback');
```

client.php file:

```php
connect('127.0.0.1', 6379);

$redis->hSet("h1", "foo", rand());
$redis->publish("c1", "hi!");
```

I run in the first terminal:

```bash
$ php server.php
```

Then, I run in the second terminal:

```bash
$ php client.php
$ php client.php
```

As a result, in the first terminal:

```sh
message: 'hi!'
foo: bool(false)

message: 'hi!'
foo: bool(false)
```