Monday, 1 May 2017

Should I use `Express` and `Socket.IO` separately?

For example we have this simple code:

var http = require('http');
var express = require('express');
var app = express();

var server = http.createServer(app);
var io = require('socket.io').listen(server);

server.listen(80);

When / is loaded and start button pushed via socket.io request sent which starts on back-end heavy stuff (lot of different http requests which could be from 5 to 10 sec) and when response comes it immediately are throw back to the browser.

So the main question: should I split the app in to two pieces?

  1. back-end with Socket.IO as one process
  2. front-end with Express as second process

I'm aware that when the long requests comes it will block Express. For example when one user do search for others site will be down while long requests are in progress.



via user1692333

No comments:

Post a Comment