Vingo is a fitness lottery service that your daily steps become your lottery number every night. Every night it sent a push notification to all users to bet their daily step counts as a lottery number in the app.
Vingo is a fitness lottery service that your daily steps become your lottery number every night. Every night it sent a push notification to all users to bet their daily step counts as a lottery number in the app. Then it announced the daily random number. If a user's lottery number matched the daily random number, the user got a cash reward.
We had struggled to expand the active number of users in SPRYFIT because each user had to bet money to join a game. People didn't want to take a risk to lose money. Therefore we would like to make people interested in their fitness data even though they weren't passionate about doing a fitness activity.
Our objective is a real-time fitness lottery show everybody could bet their daily step number as a lottery number. Users in Vingo Live joined the app before the app would announce the daily lucky number. After entering the app, it showed queued contents by a specific time. The challenging thing was syncing the queued contents to everyone in real-time.
I used Node.js with the Socket.io library to implement it, and it enabled the app to get a queued signal as a stream. Also, I used the HAProxy to scale up socket instances. To sync the states of queue contents across multiple instances, I used Redis to keep consistent states. Additionally, I replicated the Redis instance and used Sentinel to sync replicated Redis instances for scale-up purposes.
I used MySQL to save the daily lottery history from the Redis states after the daily lottery show. I also replicated the MySQL instances and used MHA Manager to sync across them.
I used Node.js with Express.js to implement APIs for the mobile client. We provided multiple game items. For example, a user could use an item to bet multiple lottery numbers to increase the winning rate.
There were multiple batches to update each user's rewards and points to bet a daily step number. Additionally, if a user won a prize in the daily lottery, the user got rewarded and could request the cash through Paypal. So I implemented a daily batch to process the cash reward and the withdrawal requests.
Vingo for iOS application should show specific content by the queued signal from the Socket stream. I implemented the iOS app with the Socket.io library to receive particular streams.
For the iOS app, I chose MVVM-C architecture and Reactive programming. So the application was easy to add a new feature and easy to maintain with multiple co-engineers.
The libraries for the iOS app are below,
The service's back-end infrastructure was using Google Cloud Domain, Load Balancing, Storage, and Compute Engine.