ActionCable and WebSockets – Part 1(The Basics)

One of the best thing about Rails is the ease with which it allows you to develop web apps quickly by providing some sensible conventions. And with Rails 5, it allows you to make real-time web apps in a breeze Introducing ActionCable.. a real time framework for communication over websockets. But before we proceed any further, let’s spend some time discussing how we got to the action cable.. or particularly, the web sockets. When the web started becoming more dynamic with ajax and js advances, we, as developers, started finding ways to make our applications more real-time. POLLING One of the earliest solutions that came up was…

ActionCable and WebSockets – Part 2(The Implementation)

You can visit the Part 1 here. THE RAILS WAY… When you create a new rails 5 application, rails generates some files for you: For any implementation of a websocket connection, we need both the client and the server parts of the code. CLIENT SIDE For the client side Rails provides app/assets/javascripts/cable.js which loads action_cable js and all files in channels directory. On page load, a consumer is created and exposed via App.cable. If we would go a little bit into the client side code for action_cable, we would find that rails does all the heavy loading like instantiating subscriptions and connections…monitoring connections etc. pretty cool.. right ?…

Multiple-Databases In Single Rails Application

This is a simple post to list some of the challenges faced during multiple database setup in a single rails application. The content in the post is available over the internet, we have consolidated it here to bring it at one place. While integrating multiple third party services we felt the need to store each and every pair of request-response shared between our application and others. We decided to use database tables to store this information instead of files or other options so to have an easy disintegration of data. This helped us in filtering for some particular handshakes based on certain scenarios. Also we could pick…

Generate paperclip missing styles on the fly

Like most developers, who use paperclip gem with their RubyOnRails applications to support picture uploading and generation of distinct styles/thumbnails of pictures, for displaying them in various views, we also do the same in a lot of our apps. After running one such web app in production for 2 years, the app needed to be redesigned. This required us to generate couple more styles/sizes for each uploaded image. Paperclip provides a method ‘reprocess!(:style)’ to generate all/one style(s). Now, when we planned to move this new version of the app to production, we had to generate those missing styles. There were a few thousand thumbnails to be generated,…

‘Launching Soon’ – Helping Startups Build Online Identity Even before the Actual Launch

The process of brand building begins even before the actual website is launched. To have an eye-catching temporary ‘Launching Soon’ page can do a world of good for your online brand identity. It is the first step that lets you create initial buzz about your business and, therefore, it becomes imperative to have a dedicated ‘Launching Soon’ or ‘Coming Soon’ page in place. Needless to say that an aesthetic landing page embosses a long lasting and distinctive impression in the visitors’ psyche, ensuring a successful first step in climbing the long ladder. Quick Introduction about ‘Launching Soon’ ‘Launching Soon’ is a simple rails plugin that helps rails…