Home  >  Q&A  >  body text

redis 订阅发布者适合语音分发的场景吗

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

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

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

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

怪我咯怪我咯2750 days ago776

reply all(1)I'll reply

  • 大家讲道理

    大家讲道理2017-04-24 09:16:03

    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

    reply
    0
  • Cancelreply