redis 订阅发布者适合语音分发的场景吗
怪我咯
怪我咯 2017-04-24 09:14:03
0
1
714

比如滴滴打车, 当一个用户发送语音后, 消息被推送到附近的司机手中

  1. 这样的需求用redis的订阅发布步骤是怎么样的呢?

  2. redis的客户端订阅后该线程就一直阻塞吗? 那么怎么主动的取消订阅呢?

请大家帮忙看一看,谢谢大家了,刚接触redis

怪我咯
怪我咯

走同样的路,发现不同的人生

reply all(1)
大家讲道理

Redis is not recommended to distribute voice directly.
You can:

  • First store the voice somewhere and generate an ID

  • Then use Redis subscription to distribute this ID

  • The client receives this event and actively pulls the voice of this ID.

Redis is blocked after being subscribed. KILL the process and it will be canceled
Are you going to make an APP? The mobile network is unstable, the network fluctuates, the connection is disconnected and the subscription is canceled.
If it is mobile, you can maintain a socket for distribution. The server can consider node.js and the like

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!