Closed jeremyricharddavies closed 10 years ago
No, but it sounds very useful. Let's put it on track.
For example, if you have a connection that is SUBSCRIBEd, you can't issue any other commands to determine if the connection is still up. Currently, even another SUBSCRIBE command generates a 'Unexpected response' error.
The redis-cli interface will drop out if the connection drops (tested by stopping the redis-server that it is connected to).
Perhaps there can be some notification on the subscription channel that the connection has closed, provided that hiredis can notify of that event.
Without this feature, pub/sub is pretty much useless in this library :) Would be great to hear if its possible to add
It would be indeed useful. Sorry for the awful delay, I took a small break but now that I'm getting back to open source I can get my hands on this :-).
All good - thanks for the update!
Please see the experimental
branch and the provided example: https://github.com/gosexy/redis/blob/experimental/_examples/test-server-disconnection/main.go
Merged into the master
branch :-).
From now on, the Subscribe()
method will return and error value (redis.ErrEOF
) when the connection is dropped.
Nice, will give it a go, thanks!
When a client is connected and using PUBSUB, is there any notification mechanism that the client can use to determine if the connection to redis has dropped?