redis-cli - Run Redis commands from Redis client

redis-cli is a Redis client for running Redis commands. It is automatically installed when you install the Redis server.

redis-cli

This will start the Redis client.

Redis command

Run the Redis command.

PUBLISH to run PUB

Run the PUBLISH command to run PUB. PUB is used for push notifications.

PUBLISH channel name message

Both the channel name and the message are just strings. If you need a complex data structure, use JSON for the message.

The channel name is a global namespace for all processes, so come up with a non-overlapping name.

PUBLISH /foo/bar/baz?id=5 Hello
PUBLISH "/foo/bar/baz?id=5" "Hello"
PUBLISH "/foo/bar/baz?id=5" '{message : "Hello"}'

Both double and single quotes can be used to enclose the string.

Associated Information