When Real-Time Web Meets Moving Objects

The World Wide Web celebrated its silver jubilee only last year. The web’s evolution of the last 25 years, from “Information Management: A Proposal” to the vastly complex network of today, is truly mind-blowing. Equally incredible is how much we rely on it—so much so that it has become a sine qua non of our lives.

The web has made quite a few hops from where it started. Of course, you can’t step in the same river twice, but if we extend that metaphor, the web has become a raging flood rather than a river. Our online invoicing service Hiveage belongs to an older generation of the web, a river that flowed quietly and serenely. Today’s web is much more active, real-time and expressive. Media API, WebSockets, and Web Workers are only the tip of this expressiveness and activity.

Vgo, our own new “cool kid in town,” heavily utilizes some of these new tools now supported by most web browsers. Vgo is a service intended to connect vehicles—be it taxis, trucks or public transportation fleets—to the web. It’s also intended to help taxi and logistics operators to evolve their businesses to stay competitive in the face of new players like Uber. With Vgo, they can let go of old processes based on ledgers and manual bookkeeping, as well as track their vehicles for the first time.

Vgo map screenshot

Real-time information is the backbone of Vgo. While our main goal was to build a service capable of handling fleets of vehicles and delivering lightning-fast tracking to operators, we also wanted to keep it cost-effective, without any fancy gadgetry requirements. The natural choice of device was the ubiquitous smartphone. WebSockets and Server-Sent-Events APIs provided us with the means of connecting both smartphones and browsers to our web-based platform in real-time.

Performance is vital to any service. And unnecessary back-and-forth calls between the server and browser, especially when handling lots of streaming data, are hazardous to performance. Here too, HTML5 additions came to our help. We heavily use client-side storage options to deliver our service without placing an unnecessary burden on the servers. Some lesser-acknowledged features, like the Fullscreen API, help us make the service more operator-friendly.

When developing the actual app we opted for a hybrid approach. With our long-standing familiarity with Rails (CurdBee, Hiveage and many more) and its good performance and highly evolved ecosystem, we didn’t want to change the framework for the web backend and the API. However, Rails is still catching up in terms of real-time web, so we thought a Node-based app cluster was the best way to go forward with real-time communication. Even though this involves context-switching, which could sometimes be a bit inconvenient, the fact that it’s just Javascript—which everyone is familiar with—makes it less troublesome.

With a hybrid setup, our other main concern was communication between the apps. For this we opted for ZeroMQ, mainly because it provides a greatly simplified framework for networking. What we needed was a fast, persistence-less and convenient communication setup, and ZeroMQ met those requirements. Having bindings in all major languages is an additional benefit since we needed to link Ruby and Javascript domains, and maybe more in the future.

The other main tool we used in Vgo development is ReactJS from Facebook. The stateful and hierarchical compartmentalizing capability of its web components using JSX was quite useful in the context of organizing our client-side code. Our software architect (and resident JS wizard) Sameera thought its notion of virtual DOM and fast rendering of new updates would help increase the performance of our client-side operations. With what we observe today, I think we made the right call.

Join Our Team

Vgo is growing fast, and as we scale our operations, we need to scale our team too. We’re now on the lookout for engineers who would like to join our team and help us take Vgo to the next level.

Are you interested in real-time web, nodeJS and ever-evolving enhancements in web? Or are you passionate about scaling platforms, distributed web systems and DevOps? We would like to hear from you! Please write to careers@vgo.lk introducing yourself and linking to your best work.