Mathieu Bouchard

Real-Time is the new RESTful

I've started playing around with Meteor and it's been delivering as advertised. I'm very excited about what it means for the web industry. It feels like a massive, huge step forward.

I was self-brain-dumping some thoughts concerning RESTful APIs and those thoughts progressively turned into rants. I decided to shelve that blog post for the time being, but with the advent of Meteor (and Derby alike), I think my rants aren't necessarily unfounded after all.

It started with me trying to explain why I was against bootstrapping data into templates server-side. I realize it means you need to load your whole JS application first, and then do the equivalent of showing spinners until your API sends you some data to transform client-side. This feels sluggish, and I get that. But the architectural choices you need to make to support a mix of server-side and client-side templating logic can result in some rather messy code, or at least hard to maintain.

Thinking outside the HTTP box

The problem stems from the mechanics of our web infrastructure: HTTP. And within that "box" we have REST mapping to CRUD, APIs of all flavors, HTTP headers going every which way... That's all great, but you're still in the HTTP "box"... Slow. Lots of back and forth, lots of overhead. The rant I was alluding to had more expletives, so I'll keep that one to my personal Inbox, but you get the gist of what I mean. I tried to make the analogy of leveraging a RESTful API to drive an MMO game. Long story short, good luck. So why doesn't our non-gaming data deserve the same attention to speed and optimization as our friends over in non-web land?

So then the Meteor landed. Real-time for the masses. I've already started converting one of the web apps I wrote that my wife and I use for grocery shopping. Apart from learning to deal with MongoDB (didn't take me long to need a JOIN, and subsequently learn that I have no choice but to join manually client-side! But I digress...), the experience has been delightful.

And then it struck me. Hey no RESTful stuff going on! Just sockets! Does this mean I don't have to care anymore? Does the long search for the ideal RESTful API architecture end?

Does the real-time revolution mean that RESTful APIs will soon be obsolete?