The Benefits of Real-time for Any Web Application

The Benefits of Real-time for Any Web Application

By February 23, 2017Engineering

Real-time web frameworks like Meteor are usually characterized by their ability
to power collaborative and responsive applications, but the same features
also provide value to traditional applications. With Meteor in particular,
real-time is exposed to the developer as a persistent database that can be used
similarly from both client and server. This shared database serves as a single
source of truth that unifies the traditionally spread web application state:
database, application server in-memory variables, in-memory
cache, in-browser javascript variables, and in-browser DOM. The ability to
forgo manually syncing state simplifies development of even single-user CRUD applications.

The synchronization of state across the different application tiers is usually
a source of boilerplate and bugs. Consider the traditional application stack
with its varied data representations and transformations:

  • Browser document object model

    • Imperatively synced with jQuery or declaratively synced with frameworks like Angular, React, etc.
  • Browser JavaScript

    • Manually synced with AJAX and REST endpoints (or newer protocol like WebSocket with custom schema)
  • Server web application

    • Manually synced through ORM or direct database access like SQL
  • Database

Wiring up each layer requires additional code and also duplicates state in
various forms: client side javascript data structures, server side data
structures, and database representation. Some simplification is possible by
using JavaScript for both client and server. The data layers can also be made
uniform by using JSON throughout, e.g. MongoDB instead of a relational
database. However, even with these standardizations, the application developer
needs to hook up layers with REST endpoints and pushing data up and down the
layers. Meteor simplifies this stack with the following architecture:

  • Browser document object model

    • Declaratively synced with Spacebars, a templating framework based on Handlebar.js
  • Browser JavaScript

    • Automatically synced client side database (MiniMongo) with server side data structures over DDP (a transport mechanism over websockets or sockjs)
  • Server JavaScript

    • Automatically synced server side data structures with database (MongoDB) with LiveQuery
  • MongoDB

In some respects, Meteor provides a programming model that resembles the first
generation of dynamic web applications: the HTML view can be templated directly
from the database. This simplified programming model reduces the moving parts
and opportunities for bugs in any application.

About ShareThis

ShareThis has unlocked the power of global digital behavior by synthesizing social share, interest, and intent data since 2007. Powered by consumer behavior on over three million global domains, ShareThis observes real-time actions from real people on real digital destinations.

Subscribe to our Newsletter

Get the latest news, tips, and updates

Subscribe

Related Content