Today, our phones are smarter, the internet is a lot more accessible, and even our pets have connected accessories. These devices aren’t all built by prominent organizations. Most are associated with young engineers, programmers and up until now, obscurely funded start-ups. With a decent grasp of programming and equipped with the right tools, you can make your own connected device in no time.
Ruby on Rails has been used to power modern websites for about a decade now, including many of the sites built here at CognitiveClouds. Ruby remains one of our favorite languages to code in through the years since Rails has made it increasingly easy to build fully functional websites and applications in a short time. Ruby is a beautiful and elegant programming language. It is easier to learn and understand, faster to code in, well documented with an active community behind it, focusing on Object-Oriented Programming and comes with a lot of helpful packages and frameworks, especially concerning web applications.
Ruby on Rails and the Internet of Things: Is there a future?
If you choose to run on low power endpoints, then no. However, a lot of IoT is not low power endpoints. But instead, if you are running Ruby on a RasPi-Zero type of platform, there’ll be no problem, and this platform is quickly gaining popularity with IoT projects. In a low power, low CPU environment, it’s best to use compiled languages. You can use a compiled language like C and sometimes lightweight scripting languages. Soon, Ruby could be primarily used for fast prototyping web API for connected devices.
How can I send data to an IoT device?
We’ve all had days when our servers were slammed with data from all kinds of IoT devices and applications. Recently, we upgraded our entire backend and increased the capacity to support our growth. One of the key decisions in our redesign was to select Phusion Passenger Enterprise to power the Internet of Things API. Phusion Passenger’s multithreaded, hybrid evented, multi-process design is perfect for the Internet of Things pattern for applications.
Phusion Passenger is an application server and web server for Ruby, Node.js, Python, and other web apps. It has helped make web app deployments a lot simpler and far less complex by managing our apps processes and resources. Its zero-copy architecture, its C++ core, its watchdog system and its multi-threaded, hybrid evented, multi-process design have made it fast and reliable at the same time.
Typically, when it comes to communication with IoT devices, you can use REST API if the device has a direct endpoint, but many of the IoT Devices may not have one. The IoT Devices generally use low power consuming protocols like MQTT, CoAP which interacts with broker topics. So ideally if when you want to send data from a rails application, send to a pub/sub model, usually to a topic. The IoT Device which has subscribed to this topic will take the data from the specific topic and work accordingly.