SlideShare uma empresa Scribd logo
1 de 42
Baixar para ler offline
GETTING DIRTY WITH 0.7


SOCKET.IO
HELLO
 > WHOAMI
{
      "name": "socket.io"
    , "version": "0.7.0"
    , "description": "Real time apps made cross-browser & easy with a
        WebSocket-like API"
    , "keywords": ["websocket", "realtime", "socket.io", "comet", "ajax"]
    , "author": "Guillermo Rauch <guillermo@learnboost.com>"
    , "contributors": [
          { "name": "Guillermo Rauch", "email": "rauchg@gmail.com" }
        , { "name": "Arnout Kazemier", "email": "info@3rd-eden.com" }
      ]
    , "repository":{
          "type": "git"
        , "url": "https://github.com/LearnBoost/Socket.IO-node.git"
      }
    , "dependencies": {}
    , "main": "index"
    , "engines": { "node": ">= 0.4.0" }
}
STALK ME ON TWITTER

@3rdEden

  FORK ME ON GITHUB

@3rd-Eden
WHAT IS SOCKET.IO
open source
REAL TIME
DIRTY
FAST
F*CKING AWESOME
CROSS BROWSER
CROSS BROWSER
INCLUDING MOBILE & INTERNET EXPLORER 5
CROSS BROWSER
    ORLY? YA RLY
web socket
web socket

flash socket
web socket

flash socket

html file (forever iframe)
web socket

flash socket

html file (forever iframe)

xhr multipart
web socket

flash socket

html file (forever iframe)

xhr multipart

xhr polling
web socket

flash socket

html file (forever iframe)

xhr multipart

xhr polling

jsonp polling
community
      WATCHERS    2750+
         FORKS    250+
  PULL REQUESTS    110+
GROUPS MEMBERS    1000~
NODE CAMP USERS



Y U NO FORK
WHATʼS NEW IN 0.7
THE LESSONS WE LEARNED FROM 0.6
COMPLETE API
  REWRITE
var io = require(ʻsocket.ioʼ)
  , http = require(ʻhttpʼ);

var s = http.createServer(function(q,r)
{r.writeHead(200);r.end(ʻsupʼ)});

s.listen(80)
io.listen(s); // uses existing server
var io = require(ʻsocket.ioʼ)
  , http = require(ʻhttpʼ);

var s = http.createServer(function(q,r)
{r.writeHead(200);r.end(ʻsupʼ)});

s.listen(80)
io.listen(s); // uses existing server


var io = require(ʻsocket.ioʼ);
io.listen(80); // creates one for us
var io = require(ʻsocket.ioʼ).listen();

// express styled configuration
io.configure(ʻdevelopmentʼ, function(){
  io.set(ʻlog levelʼ, 3);
});
MULTIPLE
PROCESSES
NEW PROTOCOL
MESSAGE FLAGS
  FIRE AND FORGET, JSON




                 NEW PROTOCOL
io.sockets.on(ʻconnectionʼ, function (socket) {
  socket.volatile.send(ʻpew pewʼ);
  socket.json.send([{nodecamp:ʻftwʼ}]);
};




                              NEW PROTOCOL
ACKNOWLEDGEMENTS
 BETWEEN CLIENT & SERVER, SERVER & CLIENT




                          NEW PROTOCOL
// server side
io.sockets.on(ʻconnectionʼ, function (socket) {
  socket.send(ʻbyeʼ, function () {
   // ack
  });
});
// client side
var socket = io.connect();
socket.send(ʻhiʼ, function () {
  // ack
});
                              NEW PROTOCOL
NAMESPACING
   MULTIPLEXING




             NEW PROTOCOL
// server side
io.sockets.on(ʻconnectionʼ, function (socket) {
  socket.send(ʻbyeʼ, function () {
   // ack
  });
});
// client side
var socket = io.connect();
socket.send(ʻhiʼ, function () {
  // ack
});
                              NEW PROTOCOL
HANDSHAKING
FUCK YEAH, SESSIONS SUPPORT




                  NEW PROTOCOL
EVENTS


    NEW PROTOCOL
CODE SHARING
MODULES ARE REUSED ON THE CLIENT & SERVER
TESTING
BOTH FOR THE CLIENT AND THE SERVER
“ONE MORE THING™”
           © STEVE JOBS
RELEASE
  THIS WEEK
Q          A
TALK NERDY TO ME
presentation.end(‘thanks’);

Mais conteúdo relacionado

Mais procurados

node.js workshop- node.js middleware
node.js workshop- node.js middlewarenode.js workshop- node.js middleware
node.js workshop- node.js middleware
Qiong Wu
 
JavaScript Sprachraum
JavaScript SprachraumJavaScript Sprachraum
JavaScript Sprachraum
patricklee
 
IRC HTTP Stream in YAPC::Asia 2009
IRC HTTP Stream in YAPC::Asia 2009IRC HTTP Stream in YAPC::Asia 2009
IRC HTTP Stream in YAPC::Asia 2009
Yusuke Wada
 

Mais procurados (20)

LvivPy4 - Threading vs asyncio
LvivPy4 - Threading vs asyncioLvivPy4 - Threading vs asyncio
LvivPy4 - Threading vs asyncio
 
node.js workshop- node.js middleware
node.js workshop- node.js middlewarenode.js workshop- node.js middleware
node.js workshop- node.js middleware
 
NestJS
NestJSNestJS
NestJS
 
Perl: Coro asynchronous
Perl: Coro asynchronous Perl: Coro asynchronous
Perl: Coro asynchronous
 
Realtime web applications with ExpressJS and SocketIO
Realtime web applications with ExpressJS and SocketIORealtime web applications with ExpressJS and SocketIO
Realtime web applications with ExpressJS and SocketIO
 
Introduction to asyncio
Introduction to asyncioIntroduction to asyncio
Introduction to asyncio
 
aiohttp intro
aiohttp introaiohttp intro
aiohttp intro
 
Nevermore Unit Testing
Nevermore Unit TestingNevermore Unit Testing
Nevermore Unit Testing
 
JavaScript Sprachraum
JavaScript SprachraumJavaScript Sprachraum
JavaScript Sprachraum
 
Any event intro
Any event introAny event intro
Any event intro
 
Web3j 2.0 Update
Web3j 2.0 UpdateWeb3j 2.0 Update
Web3j 2.0 Update
 
Callbacks and control flow in Node js
Callbacks and control flow in Node jsCallbacks and control flow in Node js
Callbacks and control flow in Node js
 
Mirage For Beginners
Mirage For BeginnersMirage For Beginners
Mirage For Beginners
 
How to send gzipped requests with boto3
How to send gzipped requests with boto3How to send gzipped requests with boto3
How to send gzipped requests with boto3
 
Asynchronous Programming FTW! 2 (with AnyEvent)
Asynchronous Programming FTW! 2 (with AnyEvent)Asynchronous Programming FTW! 2 (with AnyEvent)
Asynchronous Programming FTW! 2 (with AnyEvent)
 
IRC HTTP Stream in YAPC::Asia 2009
IRC HTTP Stream in YAPC::Asia 2009IRC HTTP Stream in YAPC::Asia 2009
IRC HTTP Stream in YAPC::Asia 2009
 
Textile
TextileTextile
Textile
 
Introduction to Nodejs
Introduction to NodejsIntroduction to Nodejs
Introduction to Nodejs
 
Web Crawling with NodeJS
Web Crawling with NodeJSWeb Crawling with NodeJS
Web Crawling with NodeJS
 
Of Harmony and Stinginess: Applicative, Monad, and iterative library design
Of Harmony and Stinginess: Applicative, Monad, and iterative library designOf Harmony and Stinginess: Applicative, Monad, and iterative library design
Of Harmony and Stinginess: Applicative, Monad, and iterative library design
 

Destaque

Real-time Web Application with Socket.IO, Node.js, and Redis
Real-time Web Application with Socket.IO, Node.js, and RedisReal-time Web Application with Socket.IO, Node.js, and Redis
Real-time Web Application with Socket.IO, Node.js, and Redis
York Tsai
 

Destaque (8)

Web in real time - technical project - socket.io
Web in real time - technical project - socket.ioWeb in real time - technical project - socket.io
Web in real time - technical project - socket.io
 
Web socket with php v2
Web socket with php v2Web socket with php v2
Web socket with php v2
 
Building web apps with node.js, socket.io, knockout.js and zombie.js - Codemo...
Building web apps with node.js, socket.io, knockout.js and zombie.js - Codemo...Building web apps with node.js, socket.io, knockout.js and zombie.js - Codemo...
Building web apps with node.js, socket.io, knockout.js and zombie.js - Codemo...
 
WebRTC + Socket.io: building a skype-like video chat with native javascript
WebRTC + Socket.io: building a skype-like video chat with native javascriptWebRTC + Socket.io: building a skype-like video chat with native javascript
WebRTC + Socket.io: building a skype-like video chat with native javascript
 
Real-time Web Application with Socket.IO, Node.js, and Redis
Real-time Web Application with Socket.IO, Node.js, and RedisReal-time Web Application with Socket.IO, Node.js, and Redis
Real-time Web Application with Socket.IO, Node.js, and Redis
 
TDC2016POA | Trilha Web - Realtime applications com Socket.io
TDC2016POA | Trilha Web - Realtime applications com Socket.ioTDC2016POA | Trilha Web - Realtime applications com Socket.io
TDC2016POA | Trilha Web - Realtime applications com Socket.io
 
Django から各種チャットツールに通知するライブラリを作った話
Django から各種チャットツールに通知するライブラリを作った話Django から各種チャットツールに通知するライブラリを作った話
Django から各種チャットツールに通知するライブラリを作った話
 
NL20161222invited
NL20161222invitedNL20161222invited
NL20161222invited
 

Semelhante a Socket.IO

Writing robust Node.js applications
Writing robust Node.js applicationsWriting robust Node.js applications
Writing robust Node.js applications
Tom Croucher
 
SockJS Intro
SockJS IntroSockJS Intro
SockJS Intro
Ngoc Dao
 

Semelhante a Socket.IO (20)

Nodejs and WebSockets
Nodejs and WebSocketsNodejs and WebSockets
Nodejs and WebSockets
 
soft-shake.ch - Hands on Node.js
soft-shake.ch - Hands on Node.jssoft-shake.ch - Hands on Node.js
soft-shake.ch - Hands on Node.js
 
Writing robust Node.js applications
Writing robust Node.js applicationsWriting robust Node.js applications
Writing robust Node.js applications
 
Pyrax talk
Pyrax talkPyrax talk
Pyrax talk
 
Diseño y Desarrollo de APIs
Diseño y Desarrollo de APIsDiseño y Desarrollo de APIs
Diseño y Desarrollo de APIs
 
FrenchKit 2017: Server(less) Swift
FrenchKit 2017: Server(less) SwiftFrenchKit 2017: Server(less) Swift
FrenchKit 2017: Server(less) Swift
 
5.node js
5.node js5.node js
5.node js
 
Intro to Sail.js
Intro to Sail.jsIntro to Sail.js
Intro to Sail.js
 
Node worshop Realtime - Socket.io
Node worshop Realtime - Socket.ioNode worshop Realtime - Socket.io
Node worshop Realtime - Socket.io
 
SockJS Intro
SockJS IntroSockJS Intro
SockJS Intro
 
Serverless Ballerina
Serverless BallerinaServerless Ballerina
Serverless Ballerina
 
Ruby MVC from scratch with Rack
Ruby MVC from scratch with RackRuby MVC from scratch with Rack
Ruby MVC from scratch with Rack
 
Introduction to Vert.x
Introduction to Vert.xIntroduction to Vert.x
Introduction to Vert.x
 
Play!ng with scala
Play!ng with scalaPlay!ng with scala
Play!ng with scala
 
Nodejs Explained with Examples
Nodejs Explained with ExamplesNodejs Explained with Examples
Nodejs Explained with Examples
 
Nodejsexplained 101116115055-phpapp02
Nodejsexplained 101116115055-phpapp02Nodejsexplained 101116115055-phpapp02
Nodejsexplained 101116115055-phpapp02
 
Nordic APIs - Automatic Testing of (RESTful) API Documentation
Nordic APIs - Automatic Testing of (RESTful) API DocumentationNordic APIs - Automatic Testing of (RESTful) API Documentation
Nordic APIs - Automatic Testing of (RESTful) API Documentation
 
API Days Paris - Automatic Testing of (RESTful) API Documentation
API Days Paris - Automatic Testing of (RESTful) API DocumentationAPI Days Paris - Automatic Testing of (RESTful) API Documentation
API Days Paris - Automatic Testing of (RESTful) API Documentation
 
Xitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディング
Xitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディングXitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディング
Xitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディング
 
Xitrum @ Scala Matsuri Tokyo 2014
Xitrum @ Scala Matsuri Tokyo 2014Xitrum @ Scala Matsuri Tokyo 2014
Xitrum @ Scala Matsuri Tokyo 2014
 

Último

EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Último (20)

EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 

Socket.IO