Two Faye servers behind proxy using modified faye-redis engine

28 views
Skip to first unread message

Andrew Longley

unread,
Jan 16, 2018, 3:15:59 PM1/16/18
to Faye users
Hi, I have a custom Redis engine based on the base faye-redis engine running under two server instances, behind an haproxy proxy (8000 load balances to 8001 and 8002). I can demonstrate that if client A instantiates a web socket on server A, and client B instantiates a web socket on server B, messages all work, but I would like to understand why. How does server A, when the engine gets the two clients from the Redis db and calls server.deliver, does it find the web socket that client B has with server B and deliver the message to client B?

If it uses the web socket, that explains client A getting the message, but again, client B has a web socket open on server B. Perhaps server A does some sort of notification, which causes the clients to go get messages? Perhaps it's a combination of the two: deliver messages directly to web socket clients, and notify other clients to go get the message? Perhaps the proxy is doing something for me.

Thanks for Faye and for grokking my question and hopefully a simple answer that enlightens me on this ignorance.

Justin Karneges

unread,
Jan 16, 2018, 3:25:11 PM1/16/18
to faye-...@googlegroups.com
Hi Andrew,

I have not used faye-redis myself, but according to its code (and from how I would expect a redis-based integration to work) I believe it is using redis pub/sub to route messages between faye instances.

Justin

--
You received this message because you are subscribed to the Google Groups "Faye users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to faye-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Andrew Longley

unread,
Jan 16, 2018, 3:45:08 PM1/16/18
to faye-...@googlegroups.com
You are absolutely right. Each faye-redis engine subscribes to /notifications/messages, and when a message needs to be delivered, redis pub/sub causes each Faye server to wake up and try to deliver the message to all clients. But each server only delivers the messages to the clients with an open web socket connection. Thanks for clarifying that for me.

--
You received this message because you are subscribed to a topic in the Google Groups "Faye users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/faye-users/vyDozMEDomo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to faye-users+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages