Node.js talking to PROGRESS PUG Challenge Americas 2013 Tuesday, 18 September 2018 Node.js talking to PROGRESS
Node.js talking to PROGRESS Introduction Node.js PROGRESS connections Tuesday, 18 September 2018 Node.js talking to PROGRESS
Node.js talking to PROGRESS Introduction Robert Prediger 14 years experience in web development 19 years experience in PROGRESS robert.prediger@web4biz.de Tuesday, 18 September 2018 Node.js talking to PROGRESS
Node.js talking to PROGRESS Web Backend Progress Client Javascript Middleware Progress Javascript Tuesday, 18 September 2018 Node.js talking to PROGRESS
Node.js talking to PROGRESS Javascript is everywhere: Browsers Webservers Databases Mobile Devices Adobe, Google, Apple and Microsoft are spending a huge amount of money! JavaScript seems to be the worlds most used programming language. Tuesday, 18 September 2018 Node.js talking to PROGRESS
Node.js talking to PROGRESS Few facts about Javascript: 1995 Developed by Brendan Eich The Best of Lisp The Worst C / Java syntax (Sun wanted this crap) The prototypical inheritance from Self In 12 days 1999 Microsoft invented XMLHTTP 2008 Release of Google Chrome and V8 2009 Ryan Dahl invented Node.js Tuesday, 18 September 2018 Node.js talking to PROGRESS
Node.js talking to PROGRESS Typescript interface Person { firstname: string; lastname: string; } class Student { fullname : string; constructor( person : Person ) { this.fullname = person.firstname + " " + person.lastname; var user = new Student( { firstname: "Jane", lastname: "User" } ); http://www.typescriptlang.org/ Tuesday, 18 September 2018 Node.js talking to PROGRESS
Node.js talking to PROGRESS What is Node.js Server side Javascript Built on Chrome V8 Engine Event-driven, non blocking I/O model What is it for? Easily building fast, scalable network applications Perfect for data-intensive real-time application that run across distributed devices Tuesday, 18 September 2018 Node.js talking to PROGRESS
Blocking I/O Node.js database, filesystem – disk S3, external APIs – networking Tuesday, 18 September 2018 Node.js talking to PROGRESS
Node.js talking to PROGRESS Tuesday, 18 September 2018 Node.js talking to PROGRESS
Node.js talking to PROGRESS F-18 Hornet Max speed of 1,190 mph RAM Banana slug Max speed of 0.007 mph Hard disk Tuesday, 18 September 2018 Node.js talking to PROGRESS
Node.js talking to PROGRESS Typical Request F = Fast F-18 Hornet S = Slow Banana Slug FSSSSSSSSSSSSSF Tuesday, 18 September 2018 Node.js talking to PROGRESS
Node.js talking to PROGRESS Webserver Messenger WebSpeed Agent Request Thread CGI Tuesday, 18 September 2018 Node.js talking to PROGRESS
Node.js talking to PROGRESS DEFINE QUERY qCust FOR Customer. OPEN QUERY qCust FOR EACH Customer. GET FIRST qCust. <next statement> Tuesday, 18 September 2018 Node.js talking to PROGRESS
Node.js talking to PROGRESS Request with WebSpeed: Finished request Start 2nd request Green is executing thread Red is waiting on I/O Tuesday, 18 September 2018 Node.js talking to PROGRESS
Web Apps Node.js blocking I/O decreases concurrency Tuesday, 18 September 2018 Node.js talking to PROGRESS
Node.js talking to PROGRESS Tuesday, 18 September 2018 Node.js talking to PROGRESS
Node.js talking to PROGRESS Non Blocking I/O Model Tuesday, 18 September 2018 Node.js talking to PROGRESS
Node.js talking to PROGRESS Reactor Pattern Browser Click Callbacks Drag Callbacks Tuesday, 18 September 2018 Node.js talking to PROGRESS
Node.js talking to PROGRESS Event-Driven Tuesday, 18 September 2018 Node.js talking to PROGRESS
Node.js talking to PROGRESS Evented Programming $(″body″).click( function() { $(this).css( ″color″, ″red″ ); }); Event Callback Tuesday, 18 September 2018 Node.js talking to PROGRESS
Node.js talking to PROGRESS Request with Node: Reactor Request Request Green is executing thread Red is waiting on I/O Tuesday, 18 September 2018 Node.js talking to PROGRESS
Node.js talking to PROGRESS Can handle thousands of concurrent connections with minimal overhead (CPU/Memory) on a single Process! Tuesday, 18 September 2018 Node.js talking to PROGRESS
Node.js talking to PROGRESS Tuesday, 18 September 2018 Node.js talking to PROGRESS
Node.js talking to PROGRESS Summary Extremely efficient networking applications Fast javascript runtime (V8) Rapid growth in both, packages and community Tuesday, 18 September 2018 Node.js talking to PROGRESS
Socket.io Introduction Tuesday, 18 September 2018 Node.js talking to PROGRESS
Protocol for having a bidirectional communication with client. Socket.io Protocol for having a bidirectional communication with client. Tuesday, 18 September 2018 Node.js talking to PROGRESS
Node.js talking to PROGRESS Socket.io Example server.js: var io = require('socket.io').listen( 80 ); io.sockets.on('connection', function (socket) { socket.emit( 'message', { text: 'Hello World' }); socket.on('chat', function (data) { socket.broadcast.emit(data); }); }); Tuesday, 18 September 2018 Node.js talking to PROGRESS
Node.js talking to PROGRESS Socket.io Example client.js: <script src="/socket.io/socket.io.js"></script> <script> var socket = io.connect('http://test.domain'); socket.on( 'message', function (data) { console.log(data); }); socket.emit( 'chat', { message: 'Hi' } ); </script> Tuesday, 18 September 2018 Node.js talking to PROGRESS
Node.js talking to PROGRESS Demo Tuesday, 18 September 2018 Node.js talking to PROGRESS
Communication between Progress and Node.js Tuesday, 18 September 2018 Node.js talking to PROGRESS
Node.js talking to PROGRESS TCP Tuesday, 18 September 2018 Node.js talking to PROGRESS
Node.js talking to PROGRESS HTTP Tuesday, 18 September 2018 Node.js talking to PROGRESS
Node.js talking to PROGRESS Webservice Tuesday, 18 September 2018 Node.js talking to PROGRESS
Node.js talking to PROGRESS var soap = require('soap'), url = 'http://www.thomas-bayer.com/ax… args = { blz: '74369662' }; soap.createClient( url, function( err, client ) { client.getBank( args, function(err, result) { console.log( err, result ); }); Tuesday, 18 September 2018 Node.js talking to PROGRESS
node4progress Direct connect via Progress https://github.com/RobertPrediger/node4progress Tuesday, 18 September 2018 Node.js talking to PROGRESS
Messaging Progress AMQP (Advanced Messaging Queuing Protocol) AMQP is the Internet Protocol for Business Messaging Tuesday, 18 September 2018 Node.js talking to PROGRESS
Node.js talking to PROGRESS REST Tuesday, 18 September 2018 Node.js talking to PROGRESS
Node.js talking to PROGRESS var rest = require('rest'); rest.post( 'http://service.com/action', { data: 334 }) .on('complete', function(data, response) { if (response.statusCode == 201) { ... } }); Tuesday, 18 September 2018 Node.js talking to PROGRESS
Node.js talking to PROGRESS Questions? robert.prediger@web4biz.de Tuesday, 18 September 2018 Node.js talking to PROGRESS