SlideShare ist ein Scribd-Unternehmen logo
1 von 22
Downloaden Sie, um offline zu lesen
Node.JS and
WebSockets with Faye
Matjaž Lipuš
@MatjazL
Real-time web
The real-time web is a set of technologies and practices which
enable users to receive information as soon as it is published.
http://en.wikipedia.org/wiki/Real-time_web
Real-time web - Server
• Long, streaming connections
• Apache, IIS
• Node, nginx, Tornado, Thin, Netty
Real-time web - Client
• Fast, small, simple API
• Long polling, streaming, websockets
• socket.IO, Faye
NodeJS
• JavaScript bindings to system I/O
• Server-side JavaScript (Google’s V8)
• Most of Node is written in JavaScript
• Current v0.2.4
more: http://nodejs.org
NodeJS - non blocking I/O
• (almost) nothing blocks
• Similar to EventMachine and Twisted
 without "run()", simply enters event loop, like browser
• No function should direct perform I/O
• Stream everything; never force the buffering of data
NodeJS - non blocking I/O
puts("Enter your name: ");
var name = gets();
puts("Name: " + name);
puts("Enter your name: ");
gets(function (name) {
puts("Name: " + name);
});
NodeJS - One process and thread
• Event loop
 events
 callbacks
• Multi processes
 web workers API
 multi-node module
NodeJS - HTTP protocol
• Built for web
• Easy library and framework development
http.createServer(function(req, res) {
res.writeHead(200, {
"Content-Type": "text/plain"
});
res.end("Hello Worldn");
}).listen(8080);
NodeJS - JavaScript
• Anonymous functions, closures
• Only one callback at a time
• I/O through DOM event callbacks
• Javascript === evented programming
NodeJS - Modules
• CommonJS
• Built-in
 process, util, buffer
 fs, net, http
• Third part
 http://github.com/ry/node/wiki/modules
 npm package manager
NodeJS - Addons
• Glue to C and C++ libraries
extern "C" void init (Handle<Object> target)
• http://github.com/ry/node_postgres
NodeJS - In development
• API changes
• Unstable modules (SSL)
• Short release cycles
Faye
• Simple pub/sub messaging for the web
• Bayeux
more: http://faye.jcoglan.com
Faye - Concepts / patterns
• Deferrable
• Observable
• Extensible
• Timeouts
• Logging
• Set
Faye - Classes
• Server
• Connection
• Client
• Transport
 HttpTransport
 LocalTransport - in process
 WebSocket
 XHR - long polling
 JSONP - callback polling
• Channel
• Subscription
Faye - Adapters
• NodeAdapter
• RackAdapter
var server = new Faye.NodeAdapter({
mount: "/",
timeout: 60
});
Faye - Server
var Faye = require("faye"),
server = new Faye.NodeAdapter();
server.listen(8000);
server.getClient().publish("/email/new",{
text: "New email has arrived!",
});
Faye - Client
var client = new
Faye.Client("http://localhost:8000/bayeux");
client.subscribe("/messages",
function(message) {
alert("Got a message: " + message.text);
});
client.publish("/messages", {
text: "Can anyone hear me?"
});
Faye - Extensions
var serverAuth = {
incoming: function(message, callback) {
if (message.channel === "/meta/subscribe") {
checkAuth(message, function(authorized) {
if (!authorized) {
message.error = "Access denied";
}
callback(message);
});
} else {
callback(message);
}
}
};
server.addExtension(serverAuth);
server.removeExtension(serverAuth);
Links
• http://nodejs.org
• http://faye.jcoglan.com
• http://howtonode.org
• http://s3.amazonaws.com/four.livejournal/20091117/
jsconf.pdf
• http://nodejs.org/jsconf2010.pdf
• http://howtonode.org/step-of-conductor
Contact
Matjaž Lipuš
@MatjazL

Weitere ähnliche Inhalte

Was ist angesagt?

Intro to Node.js (v1)
Intro to Node.js (v1)Intro to Node.js (v1)
Intro to Node.js (v1)Chris Cowan
 
Node.js 101 with Rami Sayar
Node.js 101 with Rami SayarNode.js 101 with Rami Sayar
Node.js 101 with Rami SayarFITC
 
Create a RESTful API with NodeJS, Express and MongoDB
Create a RESTful API with NodeJS, Express and MongoDBCreate a RESTful API with NodeJS, Express and MongoDB
Create a RESTful API with NodeJS, Express and MongoDBHengki Sihombing
 
Node.js tutoria for beginner
Node.js tutoria for beginnerNode.js tutoria for beginner
Node.js tutoria for beginnerManinder Singh
 
Introduction to node.js by jiban
Introduction to node.js by jibanIntroduction to node.js by jiban
Introduction to node.js by jibanJibanananda Sana
 
JavaScript as a Server side language (NodeJS): JSConf 2011, Dhaka
JavaScript as a Server side language (NodeJS): JSConf 2011, DhakaJavaScript as a Server side language (NodeJS): JSConf 2011, Dhaka
JavaScript as a Server side language (NodeJS): JSConf 2011, DhakaNurul Ferdous
 
Vert.x keynote for EclipseCon 2013
Vert.x keynote for EclipseCon 2013Vert.x keynote for EclipseCon 2013
Vert.x keynote for EclipseCon 2013timfox111
 
Woo: Writing a fast web server
Woo: Writing a fast web serverWoo: Writing a fast web server
Woo: Writing a fast web serverfukamachi
 
Easy access to open stack object storage
Easy access to open stack object storageEasy access to open stack object storage
Easy access to open stack object storageJuan José Martínez
 
MongoDB on CloudFoundry
MongoDB on CloudFoundryMongoDB on CloudFoundry
MongoDB on CloudFoundryYohei Sasaki
 
Understand How Node.js and Core Features Works
Understand How Node.js and Core Features WorksUnderstand How Node.js and Core Features Works
Understand How Node.js and Core Features WorksHengki Sihombing
 
Node.js, for architects - OpenSlava 2013
Node.js, for architects - OpenSlava 2013Node.js, for architects - OpenSlava 2013
Node.js, for architects - OpenSlava 2013Oscar Renalias
 
Clack: glue for web apps
Clack: glue for web appsClack: glue for web apps
Clack: glue for web appsfukamachi
 
Advanced Web Hosting
Advanced Web HostingAdvanced Web Hosting
Advanced Web HostingOVHcloud
 

Was ist angesagt? (20)

Intro to Node.js (v1)
Intro to Node.js (v1)Intro to Node.js (v1)
Intro to Node.js (v1)
 
CloudFoundry@home
CloudFoundry@homeCloudFoundry@home
CloudFoundry@home
 
Node.js 101 with Rami Sayar
Node.js 101 with Rami SayarNode.js 101 with Rami Sayar
Node.js 101 with Rami Sayar
 
Create a RESTful API with NodeJS, Express and MongoDB
Create a RESTful API with NodeJS, Express and MongoDBCreate a RESTful API with NodeJS, Express and MongoDB
Create a RESTful API with NodeJS, Express and MongoDB
 
Node.js tutoria for beginner
Node.js tutoria for beginnerNode.js tutoria for beginner
Node.js tutoria for beginner
 
Introduction to node.js by jiban
Introduction to node.js by jibanIntroduction to node.js by jiban
Introduction to node.js by jiban
 
Jaap : node, npm & grunt
Jaap : node, npm & gruntJaap : node, npm & grunt
Jaap : node, npm & grunt
 
JavaScript as a Server side language (NodeJS): JSConf 2011, Dhaka
JavaScript as a Server side language (NodeJS): JSConf 2011, DhakaJavaScript as a Server side language (NodeJS): JSConf 2011, Dhaka
JavaScript as a Server side language (NodeJS): JSConf 2011, Dhaka
 
Node.js primer
Node.js primerNode.js primer
Node.js primer
 
Vert.x keynote for EclipseCon 2013
Vert.x keynote for EclipseCon 2013Vert.x keynote for EclipseCon 2013
Vert.x keynote for EclipseCon 2013
 
Woo: Writing a fast web server
Woo: Writing a fast web serverWoo: Writing a fast web server
Woo: Writing a fast web server
 
Node js for beginners
Node js for beginnersNode js for beginners
Node js for beginners
 
Easy access to open stack object storage
Easy access to open stack object storageEasy access to open stack object storage
Easy access to open stack object storage
 
Node.js concurrency
Node.js concurrencyNode.js concurrency
Node.js concurrency
 
MongoDB on CloudFoundry
MongoDB on CloudFoundryMongoDB on CloudFoundry
MongoDB on CloudFoundry
 
Understand How Node.js and Core Features Works
Understand How Node.js and Core Features WorksUnderstand How Node.js and Core Features Works
Understand How Node.js and Core Features Works
 
Introduce warden
Introduce wardenIntroduce warden
Introduce warden
 
Node.js, for architects - OpenSlava 2013
Node.js, for architects - OpenSlava 2013Node.js, for architects - OpenSlava 2013
Node.js, for architects - OpenSlava 2013
 
Clack: glue for web apps
Clack: glue for web appsClack: glue for web apps
Clack: glue for web apps
 
Advanced Web Hosting
Advanced Web HostingAdvanced Web Hosting
Advanced Web Hosting
 

Andere mochten auch

CSS3: stay tuned for style
CSS3: stay tuned for styleCSS3: stay tuned for style
CSS3: stay tuned for styleChris Mills
 
Introduction to whats new in css3
Introduction to whats new in css3Introduction to whats new in css3
Introduction to whats new in css3Usman Mehmood
 
CSS3: the new style council
CSS3: the new style councilCSS3: the new style council
CSS3: the new style councilChris Mills
 
20120912 Sd Artwork2003 12 Lo
20120912 Sd Artwork2003 12 Lo20120912 Sd Artwork2003 12 Lo
20120912 Sd Artwork2003 12 Losoutrikdd
 
Week3 217 2003
Week3 217 2003Week3 217 2003
Week3 217 2003楊 騏
 
慧心菩提18
慧心菩提18慧心菩提18
慧心菩提18yhs1993
 
Mechanics
MechanicsMechanics
MechanicsPhysEM
 
Indian Scientific Heritage part2
Indian Scientific Heritage part2Indian Scientific Heritage part2
Indian Scientific Heritage part2versatile36
 
Cochin Flower Show 2011
Cochin Flower Show 2011Cochin Flower Show 2011
Cochin Flower Show 2011Johnson C.J
 
Linkedin for Sales and Recruiting
Linkedin for Sales and RecruitingLinkedin for Sales and Recruiting
Linkedin for Sales and RecruitingCraig Fisher
 
FP2003 ch 3~5
FP2003 ch 3~5FP2003 ch 3~5
FP2003 ch 3~5楊 騏
 
Concello De ValdoviñO
Concello De ValdoviñOConcello De ValdoviñO
Concello De ValdoviñOguest978c92b
 
Didáctica del Error - Hacia un Aprendizaje para la Vida - Gesvin Romero
Didáctica del Error - Hacia un Aprendizaje para la Vida - Gesvin RomeroDidáctica del Error - Hacia un Aprendizaje para la Vida - Gesvin Romero
Didáctica del Error - Hacia un Aprendizaje para la Vida - Gesvin RomeroGesvin Romero Moreno
 
Ag Stravaganza Jeopardy
Ag Stravaganza JeopardyAg Stravaganza Jeopardy
Ag Stravaganza JeopardyDan Karn
 
20120920 Soutrik Portfolio Medium
20120920 Soutrik Portfolio Medium20120920 Soutrik Portfolio Medium
20120920 Soutrik Portfolio Mediumsoutrikdd
 

Andere mochten auch (20)

CSS3: stay tuned for style
CSS3: stay tuned for styleCSS3: stay tuned for style
CSS3: stay tuned for style
 
Introduction to whats new in css3
Introduction to whats new in css3Introduction to whats new in css3
Introduction to whats new in css3
 
CSS3: the new style council
CSS3: the new style councilCSS3: the new style council
CSS3: the new style council
 
Mini-projects
Mini-projectsMini-projects
Mini-projects
 
20120912 Sd Artwork2003 12 Lo
20120912 Sd Artwork2003 12 Lo20120912 Sd Artwork2003 12 Lo
20120912 Sd Artwork2003 12 Lo
 
O'Smiley
O'SmileyO'Smiley
O'Smiley
 
ERP - Julasoft
ERP - JulasoftERP - Julasoft
ERP - Julasoft
 
IML Connector
IML ConnectorIML Connector
IML Connector
 
Week3 217 2003
Week3 217 2003Week3 217 2003
Week3 217 2003
 
慧心菩提18
慧心菩提18慧心菩提18
慧心菩提18
 
Mechanics
MechanicsMechanics
Mechanics
 
Indian Scientific Heritage part2
Indian Scientific Heritage part2Indian Scientific Heritage part2
Indian Scientific Heritage part2
 
Cochin Flower Show 2011
Cochin Flower Show 2011Cochin Flower Show 2011
Cochin Flower Show 2011
 
Linkedin for Sales and Recruiting
Linkedin for Sales and RecruitingLinkedin for Sales and Recruiting
Linkedin for Sales and Recruiting
 
FP2003 ch 3~5
FP2003 ch 3~5FP2003 ch 3~5
FP2003 ch 3~5
 
Il Codice
Il CodiceIl Codice
Il Codice
 
Concello De ValdoviñO
Concello De ValdoviñOConcello De ValdoviñO
Concello De ValdoviñO
 
Didáctica del Error - Hacia un Aprendizaje para la Vida - Gesvin Romero
Didáctica del Error - Hacia un Aprendizaje para la Vida - Gesvin RomeroDidáctica del Error - Hacia un Aprendizaje para la Vida - Gesvin Romero
Didáctica del Error - Hacia un Aprendizaje para la Vida - Gesvin Romero
 
Ag Stravaganza Jeopardy
Ag Stravaganza JeopardyAg Stravaganza Jeopardy
Ag Stravaganza Jeopardy
 
20120920 Soutrik Portfolio Medium
20120920 Soutrik Portfolio Medium20120920 Soutrik Portfolio Medium
20120920 Soutrik Portfolio Medium
 

Ähnlich wie Node.JS and WebSockets with Faye

Groovy & Grails eXchange 2012 vert.x presentation
Groovy & Grails eXchange 2012 vert.x presentationGroovy & Grails eXchange 2012 vert.x presentation
Groovy & Grails eXchange 2012 vert.x presentationStuart (Pid) Williams
 
introduction to node.js
introduction to node.jsintroduction to node.js
introduction to node.jsorkaplan
 
Introduction to Node.js: What, why and how?
Introduction to Node.js: What, why and how?Introduction to Node.js: What, why and how?
Introduction to Node.js: What, why and how?Christian Joudrey
 
Node.js to the rescue
Node.js to the rescueNode.js to the rescue
Node.js to the rescueMarko Heijnen
 
Node js quick-tour_v2
Node js quick-tour_v2Node js quick-tour_v2
Node js quick-tour_v2http403
 
Node js quick tour v2
Node js quick tour v2Node js quick tour v2
Node js quick tour v2Wyatt Fang
 
Node js quick-tour_v2
Node js quick-tour_v2Node js quick-tour_v2
Node js quick-tour_v2tianyi5212222
 
End-to-end W3C APIs - tpac 2012
End-to-end W3C APIs - tpac 2012End-to-end W3C APIs - tpac 2012
End-to-end W3C APIs - tpac 2012Alexandre Morgaut
 
Building APIs with NodeJS on Microsoft Azure Websites - Redmond
Building APIs with NodeJS on Microsoft Azure Websites - RedmondBuilding APIs with NodeJS on Microsoft Azure Websites - Redmond
Building APIs with NodeJS on Microsoft Azure Websites - RedmondRick G. Garibay
 
"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)
"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)
"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)Tech in Asia ID
 
Server-Side JavaScript Developement - Node.JS Quick Tour
Server-Side JavaScript Developement - Node.JS Quick TourServer-Side JavaScript Developement - Node.JS Quick Tour
Server-Side JavaScript Developement - Node.JS Quick Tourq3boy
 
A brief intro to nodejs
A brief intro to nodejsA brief intro to nodejs
A brief intro to nodejsJay Liu
 
Developing Revolutionary Web Applications using Comet and Ajax Push
Developing Revolutionary Web Applications using Comet and Ajax PushDeveloping Revolutionary Web Applications using Comet and Ajax Push
Developing Revolutionary Web Applications using Comet and Ajax PushDoris Chen
 
Practical Use of MongoDB for Node.js
Practical Use of MongoDB for Node.jsPractical Use of MongoDB for Node.js
Practical Use of MongoDB for Node.jsasync_io
 
FITC - Node.js 101
FITC - Node.js 101FITC - Node.js 101
FITC - Node.js 101Rami Sayar
 

Ähnlich wie Node.JS and WebSockets with Faye (20)

Groovy & Grails eXchange 2012 vert.x presentation
Groovy & Grails eXchange 2012 vert.x presentationGroovy & Grails eXchange 2012 vert.x presentation
Groovy & Grails eXchange 2012 vert.x presentation
 
introduction to node.js
introduction to node.jsintroduction to node.js
introduction to node.js
 
Introduction to Node.js: What, why and how?
Introduction to Node.js: What, why and how?Introduction to Node.js: What, why and how?
Introduction to Node.js: What, why and how?
 
Node.js to the rescue
Node.js to the rescueNode.js to the rescue
Node.js to the rescue
 
signalr
signalrsignalr
signalr
 
Node js quick-tour_v2
Node js quick-tour_v2Node js quick-tour_v2
Node js quick-tour_v2
 
Node js quick tour v2
Node js quick tour v2Node js quick tour v2
Node js quick tour v2
 
Node js quick-tour_v2
Node js quick-tour_v2Node js quick-tour_v2
Node js quick-tour_v2
 
End-to-end W3C APIs - tpac 2012
End-to-end W3C APIs - tpac 2012End-to-end W3C APIs - tpac 2012
End-to-end W3C APIs - tpac 2012
 
Building APIs with NodeJS on Microsoft Azure Websites - Redmond
Building APIs with NodeJS on Microsoft Azure Websites - RedmondBuilding APIs with NodeJS on Microsoft Azure Websites - Redmond
Building APIs with NodeJS on Microsoft Azure Websites - Redmond
 
Node and Azure
Node and AzureNode and Azure
Node and Azure
 
"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)
"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)
"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)
 
Server-Side JavaScript Developement - Node.JS Quick Tour
Server-Side JavaScript Developement - Node.JS Quick TourServer-Side JavaScript Developement - Node.JS Quick Tour
Server-Side JavaScript Developement - Node.JS Quick Tour
 
A brief intro to nodejs
A brief intro to nodejsA brief intro to nodejs
A brief intro to nodejs
 
Developing Revolutionary Web Applications using Comet and Ajax Push
Developing Revolutionary Web Applications using Comet and Ajax PushDeveloping Revolutionary Web Applications using Comet and Ajax Push
Developing Revolutionary Web Applications using Comet and Ajax Push
 
Practical Use of MongoDB for Node.js
Practical Use of MongoDB for Node.jsPractical Use of MongoDB for Node.js
Practical Use of MongoDB for Node.js
 
Beginners Node.js
Beginners Node.jsBeginners Node.js
Beginners Node.js
 
Real time web
Real time webReal time web
Real time web
 
FITC - Node.js 101
FITC - Node.js 101FITC - Node.js 101
FITC - Node.js 101
 
JavaScript Event Loop
JavaScript Event LoopJavaScript Event Loop
JavaScript Event Loop
 

Kürzlich hochgeladen

activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfJamie (Taka) Wang
 
9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding TeamAdam Moalla
 
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IES VE
 
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationUsing IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationIES VE
 
UiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPathCommunity
 
Linked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesLinked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesDavid Newbury
 
How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?IES VE
 
Computer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and HazardsComputer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and HazardsSeth Reyes
 
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UbiTrack UK
 
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAAnypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAshyamraj55
 
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaborationbruanjhuli
 
Videogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfVideogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfinfogdgmi
 
Bird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemBird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemAsko Soukka
 
Comparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioComparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioChristian Posta
 
Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)Commit University
 
20230202 - Introduction to tis-py
20230202 - Introduction to tis-py20230202 - Introduction to tis-py
20230202 - Introduction to tis-pyJamie (Taka) Wang
 
AI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity WebinarAI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity WebinarPrecisely
 
UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8DianaGray10
 
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsIgniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsSafe Software
 

Kürzlich hochgeladen (20)

activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
 
9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team
 
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
 
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationUsing IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
 
UiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation Developers
 
Linked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesLinked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond Ontologies
 
How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?
 
Computer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and HazardsComputer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and Hazards
 
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
 
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAAnypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
 
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
 
201610817 - edge part1
201610817 - edge part1201610817 - edge part1
201610817 - edge part1
 
Videogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfVideogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdf
 
Bird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemBird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystem
 
Comparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioComparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and Istio
 
Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)
 
20230202 - Introduction to tis-py
20230202 - Introduction to tis-py20230202 - Introduction to tis-py
20230202 - Introduction to tis-py
 
AI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity WebinarAI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity Webinar
 
UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8
 
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsIgniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
 

Node.JS and WebSockets with Faye

  • 1. Node.JS and WebSockets with Faye Matjaž Lipuš @MatjazL
  • 2. Real-time web The real-time web is a set of technologies and practices which enable users to receive information as soon as it is published. http://en.wikipedia.org/wiki/Real-time_web
  • 3. Real-time web - Server • Long, streaming connections • Apache, IIS • Node, nginx, Tornado, Thin, Netty
  • 4. Real-time web - Client • Fast, small, simple API • Long polling, streaming, websockets • socket.IO, Faye
  • 5. NodeJS • JavaScript bindings to system I/O • Server-side JavaScript (Google’s V8) • Most of Node is written in JavaScript • Current v0.2.4 more: http://nodejs.org
  • 6. NodeJS - non blocking I/O • (almost) nothing blocks • Similar to EventMachine and Twisted  without "run()", simply enters event loop, like browser • No function should direct perform I/O • Stream everything; never force the buffering of data
  • 7. NodeJS - non blocking I/O puts("Enter your name: "); var name = gets(); puts("Name: " + name); puts("Enter your name: "); gets(function (name) { puts("Name: " + name); });
  • 8. NodeJS - One process and thread • Event loop  events  callbacks • Multi processes  web workers API  multi-node module
  • 9. NodeJS - HTTP protocol • Built for web • Easy library and framework development http.createServer(function(req, res) { res.writeHead(200, { "Content-Type": "text/plain" }); res.end("Hello Worldn"); }).listen(8080);
  • 10. NodeJS - JavaScript • Anonymous functions, closures • Only one callback at a time • I/O through DOM event callbacks • Javascript === evented programming
  • 11. NodeJS - Modules • CommonJS • Built-in  process, util, buffer  fs, net, http • Third part  http://github.com/ry/node/wiki/modules  npm package manager
  • 12. NodeJS - Addons • Glue to C and C++ libraries extern "C" void init (Handle<Object> target) • http://github.com/ry/node_postgres
  • 13. NodeJS - In development • API changes • Unstable modules (SSL) • Short release cycles
  • 14. Faye • Simple pub/sub messaging for the web • Bayeux more: http://faye.jcoglan.com
  • 15. Faye - Concepts / patterns • Deferrable • Observable • Extensible • Timeouts • Logging • Set
  • 16. Faye - Classes • Server • Connection • Client • Transport  HttpTransport  LocalTransport - in process  WebSocket  XHR - long polling  JSONP - callback polling • Channel • Subscription
  • 17. Faye - Adapters • NodeAdapter • RackAdapter var server = new Faye.NodeAdapter({ mount: "/", timeout: 60 });
  • 18. Faye - Server var Faye = require("faye"), server = new Faye.NodeAdapter(); server.listen(8000); server.getClient().publish("/email/new",{ text: "New email has arrived!", });
  • 19. Faye - Client var client = new Faye.Client("http://localhost:8000/bayeux"); client.subscribe("/messages", function(message) { alert("Got a message: " + message.text); }); client.publish("/messages", { text: "Can anyone hear me?" });
  • 20. Faye - Extensions var serverAuth = { incoming: function(message, callback) { if (message.channel === "/meta/subscribe") { checkAuth(message, function(authorized) { if (!authorized) { message.error = "Access denied"; } callback(message); }); } else { callback(message); } } }; server.addExtension(serverAuth); server.removeExtension(serverAuth);
  • 21. Links • http://nodejs.org • http://faye.jcoglan.com • http://howtonode.org • http://s3.amazonaws.com/four.livejournal/20091117/ jsconf.pdf • http://nodejs.org/jsconf2010.pdf • http://howtonode.org/step-of-conductor