Redis PUB/SUB over HTTP

264 views
Skip to first unread message

saurabh pratap singh

unread,
Jun 8, 2020, 3:55:40 PM6/8/20
to Redis DB
Is there any way I can use Redis Pub/Sub over HTTP ? 

Marcelo Zimbres Silva

unread,
Jun 8, 2020, 4:18:43 PM6/8/20
to redi...@googlegroups.com
Hallo,

perhaps this https://webd.is/?

Marcelo

Em seg, 8 de jun de 2020 21:55, saurabh pratap singh <saurab...@gmail.com> escreveu:
Is there any way I can use Redis Pub/Sub over HTTP ? 

--
You received this message because you are subscribed to the Google Groups "Redis DB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to redis-db+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/redis-db/cc78fe36-1aea-4274-b850-09207203bf9ao%40googlegroups.com.

Itamar Haber

unread,
Jun 8, 2020, 6:04:30 PM6/8/20
to redi...@googlegroups.com
Hello Saurabh,

No, there isn't, since Redis doesn't "speak" HTTP. This is perhaps doable via an HTTP proxy/app - perhaps if you can add more context to the question, people here would be able to provide advice.

On Mon, Jun 8, 2020 at 10:55 PM saurabh pratap singh <saurab...@gmail.com> wrote:
Is there any way I can use Redis Pub/Sub over HTTP ? 

--
You received this message because you are subscribed to the Google Groups "Redis DB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to redis-db+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/redis-db/cc78fe36-1aea-4274-b850-09207203bf9ao%40googlegroups.com.


--

Itamar Haber
Technicalist Evangely

Phone: +972.54.567.9692

Redis Labs



Disclaimer

The information contained in this communication from the sender is confidential. It is intended solely for use by the recipient and others authorized to receive it. If you are not the recipient, you are hereby notified that any disclosure, copying, distribution or taking action in relation of the contents of this information is strictly prohibited and may be unlawful.

saurabh pratap singh

unread,
Jun 8, 2020, 11:55:40 PM6/8/20
to redi...@googlegroups.com
Hi everyone 

Thanks for your kind responses.
To give more context .I have an
 http resource(multiple instance running ).State changes to these resources are to be propagated to the clients of this service over internet.
So currently what I am thinking is have a websocket service between http service and redis 
This websocket service acts as a proxy for clients .

Basically websocket service subscribes to redis queues for all the state changes .
The http client will subscribe to this websocket service for updates on the state .
Does it seem reasonable or are there better options ?



Roberto Spadim

unread,
Jun 9, 2020, 6:27:36 AM6/9/20
to redi...@googlegroups.com
The main point is
What it will do when reconnect? How to return previous state and sync?
Others points redis can help you for sure 

--
Roberto Spadim
SPAEmpresarial - Software ERP/Scada
Eng. Automação e Controle, Eng. Financeira

saurabh pratap singh

unread,
Jun 9, 2020, 6:44:42 AM6/9/20
to redi...@googlegroups.com
Hey

Thank you for your reply.

Previous state is not needed in this particular use case.
Only the most recent changes after client connects are relevant. 
Only requirement is that the existing client should not miss a message after a few minutes of startup.Its ok to lose few messages during startup .







Roberto Spadim

unread,
Jun 9, 2020, 7:08:57 AM6/9/20
to redi...@googlegroups.com
well, you created the requisites to start =) check stream and pub-sub methods
the websocket can be created with any async language (node.js, go, python with fastapi, php with swoole), good work :)

Vali Dr

unread,
Jun 9, 2020, 7:37:33 AM6/9/20
to Redis DB
You can use something like socket.io as a proxy that connects to redis on your server.

Your producers add items to a list, and publishes the events.
Your socket.io listens to client connections.
When a client connects, you listen to a redis pub sub event, and when you get it (and when the client connects), you push the data in the list to the client.

Socket.io can be set not to use sockets, so it will hit your http enpoint every second or so, emulating pub/sub.

saurabh pratap singh

unread,
Jun 9, 2020, 8:53:05 AM6/9/20
to redi...@googlegroups.com
Hey 

"Socket.io can be set not to use sockets, so it will hit your http enpoint every second or so, emulating pub/sub."
Is it going to be a polling like call or something else  because polling is something which I want to avoid (as 1. notifications are expected to be in real time 2.Performance issues ??)


--
You received this message because you are subscribed to the Google Groups "Redis DB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to redis-db+u...@googlegroups.com.

Roberto Spadim

unread,
Jun 9, 2020, 9:00:15 AM6/9/20
to redi...@googlegroups.com
It's a problem related to node.js / front end implementation, at the backend where redis live, you just should implement the http-redis communication protocol
socket.io is a node.js lib, you must create this communication anyway

Vali Dr

unread,
Jun 9, 2020, 9:16:58 AM6/9/20
to Redis DB
Socket.io works with sockets, WS:// and falls back on HTTP:// pulling.
(You asked for specifically HTTP://, so that's the pulling part)

But this is not really related to redis, the only role redis will play here is:
- hold your messages/pub/sub on the client side.

Socket.io emulates some of this PUB/SUB functionality so you can pass this data over WS:// HTTP://

If your connecting one server to another (not client browser), then you can connect from server A to server B via the public IP... 


On Tuesday, June 9, 2020 at 8:53:05 AM UTC-4, saurabh pratap singh wrote:
Hey 

"Socket.io can be set not to use sockets, so it will hit your http enpoint every second or so, emulating pub/sub."
Is it going to be a polling like call or something else  because polling is something which I want to avoid (as 1. notifications are expected to be in real time 2.Performance issues ??)


On Tue, Jun 9, 2020 at 5:07 PM Vali Dr <val...@gmail.com> wrote:
You can use something like socket.io as a proxy that connects to redis on your server.

Your producers add items to a list, and publishes the events.
Your socket.io listens to client connections.
When a client connects, you listen to a redis pub sub event, and when you get it (and when the client connects), you push the data in the list to the client.

Socket.io can be set not to use sockets, so it will hit your http enpoint every second or so, emulating pub/sub.

--
You received this message because you are subscribed to the Google Groups "Redis DB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to redi...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages