redis - 如何确定收听广播的客户端数量?

标签 redis laravel-5 broadcasting

我正在使用 laravel 5.1,我想知道有多少客户正在收听某个特定 channel ,比如 Test-Channel。我想要服务器上的这个号码?有什么办法可以得到它吗?此外,我正在使用 Redis 广播。

广播文档链接如下:

Laravel 5.1 Event Broadcasting

最佳答案

redis 中有这方面的命令。查看PUBSUB NUMSUB:

Returns the number of subscribers (not counting clients subscribed to patterns) for the specified channels.

和 PUBSUB NUMPAT:

Returns the number of subscriptions to patterns (that are performed using the PSUBSCRIBE command). Note that this is not just the count of clients subscribed to patterns but the total number of patterns all the clients are subscribed to.

编辑:还值得注意的是 PUBLISH命令还返回接收者的数量:

Return value

Integer reply: the number of clients that received the message.

关于redis - 如何确定收听广播的客户端数量?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30821715/

相关文章:

java - 使用 Redis 运行 Storm 时出错 : java. lang.NoClassDefFoundError: Lredis/clients/jedis/Jedis

php - Laravel Request::input 调用未定义的方法

database - 如果数据不断变化,你缓存什么? (以推特为例)

mysql - 如何更改 Laravel 中表格的文本类型列的内容?

php - 查询构建器条件参数

Pandas 数据帧减法导致南

Java - 创建 "BroadCaster"

android - 支持移动设备的音频广播服务

redis - Redis Master之间的同步

python - 当 2 个不同的窗口访问同一个键时,为什么 Redis 返回 2 个不同的类型?