2

CONTEXT

App: Single-page real-time web app

Functionality:

  • User manipulates widgets on app, widget data sent to server
  • Server computes using worker thread & sends data back to app

Communication:

  • Type: At present only app <--> server.
  • Will need pub/sub in future
  • Size: JSON few kB per update either way
  • Frequency: 1-10 updates per minute

Peak load: Several hundred concurrent users (but of course)

Developer competence: Muggle


APPROACHES

1) Naive approach: Hosted node.js + express + socket.io

I have a sandbox running ok with the naive approach, but I feel like Toonces The Driving Cat (I told you he could drive! Just not very well!). I have the helmet on for csp, xframe, xss etc, but my socket.io code is very basic, no special event handlers or traffic throttling.

2) Alternate approach: Hosted node.js + Hosted real-time data/messaging service

Expectation here is that the hosted real-time data/messaging service is robust and can scale to traffic, apart from handling issues like DoS and secure transport. The hosted node.js app would serve static files behind a CDN, hence dealing primarily with the real-time data and worker threads. The node.js app will not directly face the web app users.


QUESTION

Would you recommend approach #2 as obviously superior and worth the extra cost?

Any other comments/suggestions welome.

user1685529
  • 237
  • 1
  • 3
  • 11

1 Answers1

2

A bit late to the party here but I think this might be helpful to others as well. In essence, you have to evaluate your ability to manage the stack that underpins a real-time web app, i.e. are you able to configure all the components - socket.io, express, node, and keep them running?

You can make your life easier by going with a framework that simplifies things a little. Meteor (https://www.meteor.com/) is a great example that will allow you to focus more on the code. You still need some knowledge for deploying Meteor, but it will take some of the workload.

At the extreme end, you can go for a fully hosted framework like Sync Ninja (http://www.syncninja.com/) which will let you deal with only your code.

From experience, it's worth going with hosted solutions when you are just starting because you can focus on building your app rather than managing the back-end.

Disclaimer: I worked on Sync Ninja.

Andrei Polmolea
  • 147
  • 1
  • 8