Custom WebSocket implementation with ActionCable on Electron/Node

Are you using an ActionCable client on Electron app? You want some extra compression with messagepack? Read on! NOTE: If you are looking for adding support for compression to your Rails backend, see the previous post. Chromium already handles compressed websocket frames with the permessage-deflate protocol. But if you have…

Custom WebSocket extension for Rails ActionCable

In the previous post, we saw how to support compression with permessage-deflate extension for Rails ActionCable connections. Now that we are there, let's go one step further and see how we can create a custom extension for WS frame compression. As an example, I'll demonstrate a way to compress JSON…

Compressing WebSocket/ActionCable frames on Rails with permessage-deflate

WebSockets are great for a long-running connection with the client. Can we make them better, faster maybe? The answer is yes and it's very simple. This post describes how to make those WebSocket connections feel even snappier. HTTP You have probably already heard about compression and are using it for…

Stimulus: A modest JS framework

Introduction When I first came across Stimulus, I was excited. The premise is great, especially when coupling with a rails app. Convention over configuration, right? No more jQuery code sprinkled around throughout the page and watching for load/change events to perform changes. Not to mention the quirks that come…

Adding static methods to existing modules using Declaration Merging in TypeScript

Introduction The main selling point of TypeScript is the ability to describe the shapes of JavaSCript objects at the type level. One example that is unique to TypeScript is Declaration Merging. Declaration Merging At the simplest level, declaration merging looks like this: interface Box { height: number; width: number; } interface Box…

Unknown is coming to TypeScript 3.0

If you use typescript, you must have come across the all-powerful any type. While it can encompass all possible types, it also makes TypeScript skip any type checking on it. This is great for some use cases where you are not sure about the structure of the object but want…