Redis Pub/Sub: PUBLISH channel message
Redis PUBLISH Command
Redis PUBLISH command is used to post a message to a channel.
Here are some common uses and scenarios for the "PUBLISH" command:
- Message Broadcasting: Sends a message to all subscribers of a specified channel, enabling real-time communication.
- Event Notification: Useful for notifying multiple clients about events, such as updates or changes in the system.
- Decoupled Architecture: Facilitates a decoupled architecture where publishers and subscribers operate independently, improving scalability.
- Data Distribution: Distributes data or updates across different services or clients in real-time.
Syntax:
PUBLISH channel message
Available since
2.0.0.
Return Value
Integer reply: the number of clients that received the message.
Return Value Type
Integer
Example: Redis PUBLISH
redis 127.0.0.1:6379> PUBLISH mychannel "hello, i m here" (integer) 1
Previous:
PUBSUB
Next:
PUNSUBSCRIBE
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://www.w3resource.com/redis/redis-publish-channel-message.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics