I'm writing a p2p communication between two or more node process with redis pub/sub
using ioredis
lib.
I will publish different types of messages like:
- hello: to let know to others subscriber that a new process is connected
- wanna-pick: to let a process to ask to others process if it can take a "work"
- pick: as acknowledge to notify the other process
I don't know if it is better for redis v3.2.1
to subscribe to many channels (one per message type) or create a single channel and send a json-message with an attribute that defines the message's type like:
{type: 'hello', message: 'hello i'm process foo' }
{type: 'wanna-pick', message: 'foo wanna pick work 42' }
Thanks in advance