MoscowJS slides

Photo Credit: MoscowJS

MoscowJS slides

About a week ago I presented Swarm.js at the MoscowJS meetup. The talk generated substantial interest. Well, I was asked questions till the security asked us all to leave the building :) Slides can be seen on Slideshare:

Swarm.js: реактивная синхронизация данных — Виктор Грищенко — MoscowJS 13 from MoscowJS

The slides are in Russian, kind of, but two key slides are perfectly readable in any language. First, that is the deployments scenario for Swarm.js:

Swarm: deployment

That is, basically, Redis meets Pusher: server-side component both caches objects and relays changes to client-side replicas. In the most straightforward scenario, the server runs node.js thus fully duplicating client-side logic.

That brings several advantages. First and foremost, the logic is implemented just once. Second, the server may always render static HTML for the client thus a new client is sent static gzipped HTML (fast), then downloads JSON and makes the page “live” (slow). That capability was nicknamed “holy grail” by some. Third, it streamlines development a lot that code paths are unified for local and remote operations, also client-to-server and server-to-client event propagation.

There are disadvantages as well. At scale, running a full clone of each client on the server might turn expensive. So, sometimes it makes more sense to make that “event switching bus” as dumb as possible, while running JavaScript logic in batch mode. Also, security freaks may dislike the fact that server-side logic is available for inspection. Well, security by obscurity is harmful in the long run, but it works to some degree anyways.

Another slide nicely depicts our dream: developing real-time offline-ready apps with the ease of classic local MVC apps.

Swarm: deployment

Replicated model is the key!