• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
[TW] Node.js
 

[TW] Node.js

on

  • 2,505 views

 

Statistics

Views

Total Views
2,505
Views on SlideShare
2,032
Embed Views
473

Actions

Likes
2
Downloads
10
Comments
0

5 Embeds 473

http://www.worldit.info 255
http://fiistudent.wordpress.com 209
http://feeds.feedburner.com 7
http://www.mefeedia.com 1
http://incampus.ro 1

Accessibility

Categories

Upload Details

Uploaded via as Apple Keynote

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n

[TW] Node.js [TW] Node.js Presentation Transcript

  • Server Side Programming Using Node.JS Ana-Maria Daneliuc Bogdan GazaTW2011
  • $whoarewe Students at Faculty of Computer Science ana.daneliuc@info.uaic.ro bogdan.gaza@info.uaic.roTW2011
  • JavaScriptTW2011
  • Java is to JavaScript Like ham is to hamsterTW2011
  • JavaScript • Language of the Internet • Scripting language (interpreted) • Client side - usually run by the browser • Object oriented • Event drivenTW2011
  • JavaScript • Growing in popularity • Big companies spend a lot of $$$ to improve JavaScript • Probably will become a very popular languageTW2011
  • JavaScript • Until recent no clear - server side JavaScript console interpreter • Event driven on the server side also • Code sharing • All fast evented network servers were written in C/C++TW2011
  • Node.JS Server Side JavaScriptTW2011
  • Node.js • Event driven I/O framework • Build upon V8 engine • Server Side (includes system calls + different modules) • Intended for writing scalable network programs • Written in C/C++ and JavaScriptTW2011
  • V8TW2011
  • V8 JavaScript Engine • JavaScript VM used by Google Chrome • Written by one of the leading VM engineers with 20 years of building VMs - Lars Bak • The last VM written by Lars Bak - improved JavaScript 20x times.TW2011
  • V8 JavaScript Engine • JavaScript to assembler • Improved garbage collector • Independent from Google Chrome • Limitations: No bytecode/No threads/No processesTW2011
  • Non BlockingTW2011
  • Blocking puts("Enter your name: "); var name = gets(); puts("Name: " + name);TW2011
  • Non-Blocking - Node.js way puts("Enter your name: "); gets(function(name){ puts("Name: " + name); });TW2011
  • Remember Select From the “Retele” Node.js Course aka explain select say about poll/epoll When receiving data (from network / disk / another source) there must be a callback Data is received Data Event Source loop CallBack User FunctionTW2011
  • Non-blocking vs threadedTW2011
  • Non-blocking vs threadedTW2011
  • Node.js - Hello World var http = require(http); http.createServer(function (req, res) { res.writeHead(200, {Content-Type: text/plain}); res.end(Hello Worldn); }).listen(8124, "127.0.0.1"); console.log(Server running at http://127.0.0.1:8124/);TW2011
  • Why use Node.js?TW2011
  • Real time web applicationsTW2011
  • Ajax • Asynchronous JavaScript and XML • Method to load data asynchronously • Uses XMLHttpRequest object (from JS) • Nearly real timeTW2011
  • Step 1 Loading Web Page ServerTW2011
  • Step 2 Done Web Page Server Ajax RequestTW2011
  • Step 3 Done Web Page Server Ajax RequestTW2011
  • Step 4 Done Web Page Server Ajax RequestTW2011
  • Step 5 Done Web Page Server Ajax Request For another request goto step 1TW2011
  • Comet Long-lived HTTP connections Reduce latency Messages are passed from the server to the client PUSHTW2011
  • Step 1 Loading Web Page ServerTW2011
  • Step 2 Done Web Page Server Long lived HTTPTW2011
  • Step 3 Event Done Web Page Server Long lived HTTPTW2011
  • Step 4 Done Web Page Server Long lived HTTPTW2011
  • Step 5 Done Web Page Server Long lived HTTPTW2011
  • Step 6 Done Web Page Server Long lived HTTP For another request goto step 1TW2011
  • WebSockets • Use TCP sockets from the browser • Update web page 40 times / s • API is work in progress • Not supported by all the modern browsersTW2011
  • Ajax vs Comet vs WebSockets Ajax Comet WebSocketsTW2011
  • DEMOTW2011
  • Q/ATW2011
  • Thanks!TW2011