Node js oc meetup 2 socket io intro

1,705 views

Published on

Node js oc meetup 2 socket io intro

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Node js oc meetup 2 socket io intro

  1. 1. Meetup 2 Socket IO Real Time Applications
  2. 2. WIFI
  3. 3. Who Are We Eddy @eddydkim eddy@drumbi.com Farsheed @captainatef farsheed@drumbi.com
  4. 4. Overview Last Meetup Recap Why Node JS Javascript Intro Today Realtime Web Application Aches Socket IO Cure Examples
  5. 5. Real Time Web Applications Pretty Moving Graphs Feeds (Twitter, News, etc.) Chatrooms Html5 Multiplayer Games
  6. 6. Limitations of HTML HTML Designed for Request/Response 1. Browser -> Server 2. Server -> Browser 3. Repeat
  7. 7. Solutions HTML Protocol Hacks: ● Short Polling ● Long Polling ○ <script> ○ AJAX Long Polling ● Streaming ○ XMLHttpRequest Multipart Chunks ○ Forever Iframe
  8. 8. Problems with Hacks ● HTTP Overhead for many small updates ● Resource Waste in opening and closing connections ● Latency Overhead ● Different Implementations for Each Browser
  9. 9. WebSockets To Rescue! ● Full Web Standard designed for two way communication ● Minimal Overhead for each message ● Most Modern Browsers Support it
  10. 10. WebSocket Limitations ● HTTP Upgrade Handshake Breaks some older Proxies ● Many Gateways, Load Balancers, Reverse Proxies Servers dont support websocket ● Some Firewalls block Websockets
  11. 11. Socket IO Got You Covered Socket IO Real Time Communication Library for both server and client ● Abstract Layer over Multiple Transports ○ Long Polling ○ Streaming ○ Websockets ○ Flashsockets (BLEH) ● Auto Reconnect, Heartbeats, Auto Chooses Best Transport
  12. 12. Other Good Alternatives ● socksjs ● nowjs ● engine.io (socket.io but naked)
  13. 13. How to Get Started 1. express example 2. enter example folder 3. npm install socket.io --save Farsheedius Shall walk through the rest For the impatient: echo example https://github.com/eddify/socketio-starter

×