node.jsredissocket.iosocket.io-redis

Push to talk - How to manage push button in socket.io


I have two servers where socket.io is hosted , communication between two apps are managed with redis.

When user 1 click on push button , on server side in redis, I am making entry as

Room:A -> User1

When user 2 click on push button, he get room busy message because there is already entry in redis for User1

When user 2 pull the button , I am removing the entry from the redis , so other user will get turn to speak.

But issue when there are 100 user are doing the action, it is not working in real time manner.

Any ideas on how to manage push button in socket.io?


Solution

  • I found the way to manage push button with locking.

    using following Redis library for the same :

    https://github.com/mike-marcacci/node-redlock