Redis-pub-sub-subscribe

提供:Dev Guides
移動先:案内検索

Redis-PubSub購読コマンド

Redis SUBSCRIBE コマンドは、指定されたチャネルにクライアントをサブスクライブします。

構文

以下は、Redis SUBSCRIBE コマンドの基本的な構文です。

redis 127.0.0.1:6379> SUBSCRIBE channel [channel ...]

戻り値

配列応答。

redis 127.0.0.1:6379> SUBSCRIBE mychannel
Reading messages... (press Ctrl-C to quit)
1) "subscribe"
2) "mychannel"
3) (integer) 1
1) "message"
2) "mychannel"
3) "a"