angularjs - HTTP response following long process -
the current project in node.js expressjs framework. have application client/prospect information, authenticated users allowed modify database , initiate long-running processes on server. example, printing 30 pg document 1 process.
the application user needs 2 main things:
- a response when process begins.
- a response (notification) when process ends.
we handle need #1 in standard express fashion ensuring process starts followed res.json({msg: 'process started']);
angular front end. need #2 handed email user initiated process process status report.
i improve how handle need #2. specifically, send json string user display in interface.
questions:
- is possible on http?
- does functionality exist within express or well-know middleware.
assuming 1 & 2 false. solution run tcp socket server maintain socket required users. when process ends message sent user status update. can comment on issues solution presents?
yes both 1 , 2. seek achieve here push server client. need pretty ubiquitous in web applications , there have been various solutions on years various fancy names. might read on ajax
, comet
, long-polling
, websockets
.
for node application, take @ socket.io. in nutshell, framework abstracts complexities of ajax, websockets, etc. single api. put way, socket.io gives bi-directional communications between node application , front end.
Comments
Post a Comment