Discussion:
How to use Pub/sub with hiredis in C++?
Jae Park
2012-07-25 06:22:30 UTC
Permalink
I am trying to test this pub/sub function of redis with hiredis client via
c++.

I can see that subscribing to certain channel seems to be easy enough to do
through redisCommand Api.

However I am wondering how the reply is coming back when somebody publish
to the certain server.

Thank you
--
You received this message because you are subscribed to the Google Groups "Redis DB" group.
To view this discussion on the web visit https://groups.google.com/d/msg/redis-db/-/lUsrpPYqsLAJ.
To post to this group, send email to redis-db-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to redis-db+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit this group at http://groups.google.com/group/redis-db?hl=en.
Jae Park
2012-07-25 06:21:15 UTC
Permalink
I am trying to test this pub/sub function of redis with hiredis client via
c++.

I can see that subscribing to certain channel seems to be easy enough to do
through redisCommand Api.

However I am wondering how the reply is coming back when somebody publish
to the certain server.

Thank you
--
You received this message because you are subscribed to the Google Groups "Redis DB" group.
To view this discussion on the web visit https://groups.google.com/d/msg/redis-db/-/CQdKcO2th3EJ.
To post to this group, send email to redis-db-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to redis-db+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit this group at http://groups.google.com/group/redis-db?hl=en.
Aleksandar Radulovic
2012-07-25 19:39:14 UTC
Permalink
Hi,

When you issue a redis command to subscribe to a channel, you are
supposed to pass a callback to be called whenever there's a message
sent to that channel. There are examples for redisAsyncCommand in
hiredis sources, afaik.

-alex
Post by Jae Park
I am trying to test this pub/sub function of redis with hiredis client via
c++.
I can see that subscribing to certain channel seems to be easy enough to do
through redisCommand Api.
However I am wondering how the reply is coming back when somebody publish to
the certain server.
Thank you
--
You received this message because you are subscribed to the Google Groups "Redis DB" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/redis-db/-/CQdKcO2th3EJ.
To unsubscribe from this group, send email to
For more options, visit this group at
http://groups.google.com/group/redis-db?hl=en.
--
a lex 13 x
http://a13x.net | @a13xnet
Salvatore Sanfilippo
2012-07-25 20:04:49 UTC
Permalink
p.s. warning, hiredis has a bug so that if you send the SUBSCRIBE
command while the server is loading the DB, or before AUTH, or in any
other setup where Redis will reply with an error in the form of
"-"+<something>, hiredis will crash.

I already submitted a bug report but it's better to be aware of that
to use Pub/Sub with hiredis.

Cheers,
Salvatore
Post by Aleksandar Radulovic
Hi,
When you issue a redis command to subscribe to a channel, you are
supposed to pass a callback to be called whenever there's a message
sent to that channel. There are examples for redisAsyncCommand in
hiredis sources, afaik.
-alex
Post by Jae Park
I am trying to test this pub/sub function of redis with hiredis client via
c++.
I can see that subscribing to certain channel seems to be easy enough to do
through redisCommand Api.
However I am wondering how the reply is coming back when somebody publish to
the certain server.
Thank you
--
You received this message because you are subscribed to the Google Groups
"Redis DB" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/redis-db/-/CQdKcO2th3EJ.
To unsubscribe from this group, send email to
For more options, visit this group at
http://groups.google.com/group/redis-db?hl=en.
--
a lex 13 x
--
You received this message because you are subscribed to the Google Groups "Redis DB" group.
For more options, visit this group at http://groups.google.com/group/redis-db?hl=en.
--
Salvatore 'antirez' Sanfilippo
open source developer - VMware
http://invece.org

Beauty is more important in computing than anywhere else in technology
because software is so complicated. Beauty is the ultimate defence
against complexity.
— David Gelernter
--
You received this message because you are subscribed to the Google Groups "Redis DB" group.
To post to this group, send email to redis-db-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to redis-db+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/redis-db?hl=en.
Jae Park
2012-07-26 00:37:28 UTC
Permalink
if I use a redisAsyncContext for subscribing,
is that Context unable to be used in other ways ?
--
You received this message because you are subscribed to the Google Groups "Redis DB" group.
To view this discussion on the web visit https://groups.google.com/d/msg/redis-db/-/EaI-x9j5n70J.
To post to this group, send email to redis-db-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to redis-db+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit this group at http://groups.google.com/group/redis-db?hl=en.
Loading...