centrifugal/rubycent

Redis internal messaging

gauravtiwari opened this issue · 3 comments

Hi @FZambia

One of the features you have mentioned here in the engines page is using Redis to publish messages (--redis_api) - Redis Engine Pub Sub

How does this work? Is it only available to backend or can it send messages from backend <-> frontend etc? Just collecting some info so that we can put some ruby specific examples etc.

I think I have not fully understood your question. In most scenarios to publish new message into channel you use HTTP POST request to Centrifugo API. But this introduces some HTTP overhead and you should also properly sign such API request (this Ruby client do this actually). Publishing via Redis must be done from your backend code - it allows to remove HTTP request overhead and also allows applications to publish messages into Centrifugo channel when application backend can not use our existing HTTP API clients (written in Perl or Node for example for which we don't have API clients yet)

Okay, sorry about vague description.

Can front-end client subscribe to these messages like it subscribes to HTTP API messages using Javascript client? I tried publishing using Redis from backend (like tornado example) and it was pushing the job into the queue (checked using redis-cli), but it wasn't appearing on the frontend client.

Front-end client does not aware of a way your backend publish messages into Centrifugo - so it subscribes on channels as usual.

If you already pushed message into Redis queue and it was not delivered to client then maybe you did not properly configured something, for example did not provide --redis_api flag when starting Centrifugo