🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
#### 发布订阅 [TOC] ###### SUBSCRIBE channel [channel ...] 起始版本:2.0.0 时间复杂度:O(N) where N is the number of channels to subscribe to. > 订阅给指定频道的信息。 一旦客户端进入订阅状态,客户端就只可接受订阅相关的命令SUBSCRIBE、PSUBSCRIBE、UNSUBSCRIBE和PUNSUBSCRIBE除了这些命令,其他命令一律失效。 ###### PSUBSCRIBE pattern [pattern ...] 起始版本:2.0.0 时间复杂度:O(N) where N is the number of patterns the client is already subscribed to. > 订阅给定的模式(patterns)。 支持的模式(patterns)有: ~~~ h?llo subscribes to hello, hallo and hxllo h*llo subscribes to hllo and heeeello h[ae]llo subscribes to hello and hallo, but not hillo ~~~ 如果想输入普通的字符,可以在前面添加\ ###### PUBLISH channel message 起始版本:2.0.0 时间复杂度:O(N+M) where N is the number of clients subscribed to the receiving channel and M is the total number of subscribed patterns (by any client). > 将信息 message 发送到指定的频道 channel 返回值 integer-reply: 收到消息的客户端数量。