One of the major reasons as to why companies like Uber, Grab, Didi, etc. have grown so rapidly is the fact that that they offer on-demand taxi booking services to their customer. These companies leverage cutting-edge technologies to execute real-time requests made by their customers.
Although one must also understand that executing these real-time requests is no child’s play. As Taxi Business experts, we know it takes a lot to execute all the taxi requests and operations in real-time. Even a minor lag can prove to be fatal for any taxi business.
Keeping this in mind, we at Yelowsoft have come up with a product update in our taxi solution where we have replaced Socket.io with MQTT. This move enhanced the execution speed of all real-time functionalities thus making our solution more efficient than ever. In this blog, we’ll discuss in detail as to how we achieved this feat. But first, let’s have a look at what Socket IO actually is?
What is Socket.io?
Socket.IO is a JavaScript library which is used for real-time web applications. It was created in the year 2010. It was built to utilize open connections to facilitate real-time communications which was a new thing at that time. Socket.IO enables bi-directional and real-time communication between servers and web clients.
It provides you with the ability to implement instant messaging, real-time analytics, binary streaming, and document collaboration. Socket.IO mainly uses the WebSocket protocol along with a fallback option in the form of polling.
Issues associated with Socket.IO
Earlier, we were using Soket.IO in our taxi solution for all the real-time functions. But, soon our clients started facing issues due to it. Our clients faced several issues like:
Scaling
The first major issue that our clients were facing was of scaling. Socket.IO used to work fine with a single server. However, as the number of servers increased it started showing some issues. Moreover, it has no support for multiple-string. So, if there were two clients connected via separate clusters, then it became difficult to establish communication between the two.
Acknowledgement
Another issue associated with Socket.IO was of acknowledgement. Many times, drivers didn’t receive any requests even the server showed that the request has been sent. This caused a lot of confusion and wastage of time.
Requires greater bandwidth
Socket.IO requires greater bandwidth to operate. This meant that drivers operating in the region of the low network won’t receive requests on their devices.
Eats up a lot of internet data
Another challenge associated with Socket.IO was that it used to eat up a lot of internet data.
Decided to go for managed database
To overcome the challenges posed by Socket.IO, we decided to go with a managed database. The managed database did resolve some issues, for an instance, there were no missed requests now. All the requests sent from the server were reaching to all the drivers in real-time.
However, the managed database had its own share of challenges. First, this real-time database was heavy. It also used to eat up loads of data, Secondly, it wasn’t a cost-efficient alternative since it was a managed database. We, at Yelowsoft always try to find a top-notch alternative which is most cost-efficient for our clients. In this search, we found the perfect solution in the form of MQTT. Let’s have a look at what MQTT is.
What is MQTT?
MQTT stands for Message Queuing Telemetry Transport. It’s an OASIS standard messaging protocol for Internet of Things (IoT). It’s a lightweight messaging transport that makes it ideal for connecting remote devices that have minimal network bandwidth and a small code footprint.
Benefits of using MQTT
We went with MQTT as it offered us with clusters of benefits. Let’s have a look at it one by one.
Lightweight
MQTT is extremely lightweight as it needs minimal resources and can be used on small microcontrollers. Moreover, MQTT message headers are so small that they can easily optimize the network bandwidth. We can also consider it as an updated version of Socket.IO. It’s also an efficient publisher and subscriber service.
Quality assurance
The quality assurance of MQTT ensures that even if the driver fails to receive any request due to no reception of the signal, then he would receive the request as soon as he gets the signal on his device.
Works in any kind of network
Another major benefit of MQTT is that it operates on all kind of networks. No matter if your driver has a 2G, 2G, 4G, or 5G network on his phone, with MQTT he will always receive the request on time.
Reduced data usage
Since MQTT is lightweight, it also resulted in low internet usage. For an instance, it reduced internet usage from 1.5 GB to 20 MB.
Low battery consumption
MQTT not only has low internet usage but it also doesn’t require high bandwidth. Both of these factors result in lower battery usage.
Accepts a large number of connections
Before integrating MQTT, we tested MQTT rigorously under different bandwidth. We also tested how many connections it can accept and found that it can accept a massive number of connections.
Used the most suitable broker
MQTT has a lot of brokers. Few of them are free and few of them are paid. Free brokers are required to configure and manage. Whereas, the paid brokers are not needed to manage and configure. We decided to go for a free broker as it enabled us to customize and configure as per our requirements.
Switching from Socket.IO to MQTT proved to be a game-changer for us and our clients. It’s because it single-handedly resolved all the issues related to the real-time requests thus rendering our solution faster and more efficient.
This was all about the product update. I hope this article provided you with authentic insights and the nitty-gritty of real-time requests. We’ll be coming with more such product updates for our solutions in near future. Till then keep reading this space.