WillFuqua

Native Websockets with Blazor WebAssembly

A couple of days ago, Blazor WebAssembly 3.2.0 Preview 1 was released (announcement). I'm personally excited about this release because it's the first Blazor release that contains native support for client-side websockets!

Previously, if you wanted to use websockets, you either had to write your own wrapper, or use a larger library like SignalR that did the wrapping for you. However, if you just wanted to use the normal System.Net.WebSockets.ClientWebSocket class that's built into .NET, you could not.

The Mono/WASM project has actually supported ClientWebSocket for about a year (PR 12615). However, some recent changes in Blazor allowed the Blazor project to be able continue.

tagged as , , , , and

A Caching HTTP Proxy using Titanium Web Proxy

At my work at Jetabroad I do a lot of integration with third-party webservices (like everyone these days). The webservices, especially the test endpoints, are of variable stability and responsiveness.

The responsiveness issue can be maddening when you're trying to iterate quickly. I prefer doing the bulk of my development via unit tests or integration tests to isolate myself as much as possible. However, I still ultimately find myself developing directly against these third-party services from time to time.

I built Catchy to help solve this pain. When you start it, you provide a whitelist of domains to intercept. Catchy will examine your outbound REST or SOAP continue.

tagged as , and

Pushing Database Changes to the Web with Datomic

Lately I've been playing around with Datomic, a database invented by Rich Hickey, the creator of Clojure. Datomic feels like a natural extension of Clojure's immutable, persistent datastructures. From Datomic's architecture documentation:

A Datomic database stores a collection of facts. The facts in a database are immutable; once stored, they do not change. However, old facts can be superseded by new facts over time. The state of the database is a value defined by the set of facts in effect at a given moment in time.

Daniel Higginbotham wrote a great tutorial on the basics of Datomic called Datomic for Five Year Olds, continue.

tagged as , , , , and

Native JavaScript Promises and Browser APIs

One of the interesting evolutions of mainstream JavaScript development has been the widespread adoption of Promises. Promises simplify asynchronous code. Since JavaScript in the browser uses a single-threaded, callback-based programming model, asynchronicity is everywhere.

The Problem with Asynchronicity

Asynchronous patterns are great for keeping UIs responsive and non-blocking, but they have a cost: asynchronous JavaScript code tends to be highly nested, which hurts readability. Additionally, because you can't catch errors that are thrown inside callbacks from outside those callbacks, error handling needs to be spread throughout every level of nesting.

When we use Promises, our code structure is flattened, and our error handling continue.

tagged as , , and

REST APIs and Relational Databases in Clojure

I've found that most Clojure web application articles out there cover the Ring and Compojure APIs pretty well, but stop short of the data access layer, leaving that up to you. This article will attempt to remedy that, with a focus on relational databases.

In this post we'll create a simple REST API for a todo list web application. We'll use Compojure to create a REST API, Lobos to create and manage our database tables, and Korma to query a PostgreSQL database.

Generating a Compojure Application

The first thing we'll do is set up a Compojure web application. Use Leiningen to create and continue.

tagged as , , , , , , and