For users with nodejs on linux via ssh-shell (putty):
The problem with nodejs in linux-ssh-shell is that you do not have a connected browser. I tried all these solutions, but did not get it to work.
So, I developed a solution with firebase ( https://firebase.google.com ), because my project uses firebase. If you are familiar with firebase, this is a great way. If not, firebase should be used in conjunction with nodejs - and its free!
In the server side of the script (starting with node) use your own function log ():
// server-side: // using new firebase v3 ! var fbRootRef = firebase.database(); var fbConsoleRef = fbRootRef.ref("/console"); var log = function(args) { fbConsoleRef.set({'obj': args}); } // inside your server-code: log({'key':'value'});
On the client side, you create a link to firebase on this console object:
// client side: fbRootRef.child('/console').on('value', function(d) { var v = d.val(); console.log(v); });
Now everything registered on the server side with the log () function is transferred in real time to the firebase database and from there they launch the client console link and register in the browser console.
If someone needs help, I will explain in more detail and can provide a more advanced version of this logging using the types (console./log/warn/info), grouping header information (for example, the server says: (file name + line).
Configuring firebase for your project takes a maximum of 30 minutes by inserting a console function after 30 minutes. I think it is worth the time.
Marcel Ennix Jun 21 '16 at 23:24 2016-06-21 23:24
source share