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.