Socket.IO Real-time Web Application Development


Socket.IO Real-time Web Application Development
eBook: $16.99
Formats: PDF, PacktLib, ePub and Mobi formats
$14.44
save 15%!
Print + free eBook + free PacktLib access to the book: $41.98    Print cover: $24.99
$24.99
save 40%!
Free Shipping!
UK, US, Europe and selected countries in Asia.
Also available on:
Overview
Table of Contents
Author
Support
Sample Chapters
  • Understand the usage of various socket.io features like rooms, namespaces, and sessions
  • Secure the socket.io communication
  • Deploy and scale your socket.io and Node.js applications in production
  • A practical guide that quickly gets you up and running with socket.io

Book Details

Language : English
Paperback : 140 pages [ 235mm x 191mm ]
Release Date : February 2013
ISBN : 1782160787
ISBN 13 : 9781782160786
Author(s) : Rohit Rai
Topics and Technologies : All Books, Security and Testing, Web Development, Open Source, Web Development

Table of Contents

Preface
Chapter 1: Going Real Time on the Web
Chapter 2: Getting Started with Node.js
Chapter 3: Let's Chat
Chapter 4: Making It More Fun!
Chapter 5: The Socket.IO Protocol
Chapter 6: Deploying and Scaling
Appendix A: Socket.IO Quick Reference
Appendix B: Socket.IO Backends
Index
  • Chapter 1: Going Real Time on the Web
    • What is real-time web?
    • A bit of history
    • Applications of real-time web
      • Gaming
      • Social stream updates
      • Business applications
      • Web-based monitors
    • Summary
    • Chapter 2: Getting Started with Node.js
      • The origin of Node.js
      • Why Node.js
        • JavaScript everywhere
        • Event-driven design
        • Corporate backing
      • How to get Node.js
      • Node.js package manager (npm)
      • Hello World with Node.js
      • Hello Web
      • Routing the requests
      • HTTP Methods
      • Creating our own Modules
      • Serving files
      • Third party modules and Express JS
      • Summary
      • Chapter 3: Let's Chat
        • Creating the application
        • Designing the chat room
        • Bringing in jQuery
        • Socket.IO
        • Handling events
        • The server
        • The client
        • Summary
          • Chapter 5: The Socket.IO Protocol
            • Why do we need another protocol?
              • The WebSocket API
              • The Socket.IO API
            • The Socket.IO socket
            • The Socket.IO connection
            • Socket.IO messages
              • Disconnect (0)
              • Connect (1)
              • Heartbeat (2)
              • Message (3)
              • JSON message (4)
              • Event (5)
              • ACK (6)
              • Error (7)
              • NOOP (8)
            • Summary
            • Chapter 6: Deploying and Scaling
              • The production environment
              • Running the application
              • Keeping it running
              • Scaling
              • The node cluster
              • Scaling up the application
              • Tips for node in production
              • Summary
              • Appendix A: Socket.IO Quick Reference
                • The server
                  • Instantiating socket
                  • Starting Socket.IO
                  • Listening to events
                  • Emitting an event
                  • Sending a message
                  • Sending a JSON message
                  • Broadcasting a message/event
                  • Sending a volatile message
                  • Storing socket data
                  • Getting the socket data
                  • Restricting to a namespace
                  • Joining a room
                  • Broadcasting messages/events in a room
                  • Leaving a room
                  • Changing the configuration
                • Server events
                  • connection
                  • message
                  • disconnect
                • The client
                  • Connecting to a socket
                  • Listening to events
                  • Emitting an event
                  • Sending a message
                • Client events
                  • connect
                  • connecting
                  • disconnect
                  • connect_failed
                  • error
                  • message
                  • reconnect
                  • reconnecting
                  • reconnect_failed

                  Rohit Rai

                  Rohit Rai is an accomplished software engineering professional and entrepreneur with several years of experience in developing products and consulting with clients on a variety of technologies, from enterprise applications on .NET and Java EE, consumer web applications focusing on JavaScript, data engineering and analytics platforms such as Pentaho and Hadoop, to modern platforms such as Groovy, Scala, and Node.js. He is a founder of TupleJump, a startup building a new-generation data engineering platform for unifying and optimizing the workflows of data scientists, engineers, and analysts, bringing in innovative data process development approaches and modern visualization frameworks, all built on cutting-edge technologies designed to scale transparently from a single machine to large, distributed big data clusters. He has previously worked with Cordys R&D, Pramati technologies, and various startups. He has consulted with clients like Intel and Sun, helping them develop products like Mash Maker and Zembly, powered by JavaScript. He was a member of one of the first teams on SocialTwist and developed one of the first widgets as a service platform and framework, which continues to power this widely-successful social media marketing and referral platform used by many Fortune 500 companies. In open source, Rohit is a core committer and the administrator of Matisse (http://www.matisse.org/), the collaborative design platform. He is also the creator of socket.io.play, the Socket.IO module for the Play framework, and various open source projects hosted at GitHub (https://github.com/rohit-tingendab).
                  Sorry, we don't have any reviews for this title yet.

                  Code Downloads

                  Download the code and support files for this book.


                  Submit Errata

                  Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.


                  Errata

                  - 4 submitted: last submission 06 Jan 2014

                  Errata type: Code | Page number: 26-31

                  The route has a map of the path to the handler function and also has a on method to add new routes. var route = {
                  routes : {},
                  for: function(path, handler){
                  this.routes[path] = handler;
                  }
                  }
                  route.on("/start", function(request, response){
                  response.writeHead(200, {"Content-Type": "text/plain"});
                  response.write("Hello");
                  response.end();
                  });
                  The route.on method is used in a lot of cases. It should be route.for instead.

                  Errata type: Typo | Page number: 54

                  There is a typo in the last paragraph, it says: "and here too the message will be sent as a sting", it should be: "and here too the message will be sent as a STRING"

                  Errata type: Code | Page number: 79


                  On page number 79, there's a highlighted part in the code:

                  rooms[roomName] = io.sockets.manager rooms[room].length;

                  It should be:

                  rooms[roomName] = io.sockets.manager.rooms[room].length;

                  Errata type: Code | Page number: 114


                  On page 114, in the "Emitting an event" section, the code example is:
                  socket.on(<event>, <event_data>, ack_callback);
                  It should be:
                  socket.emit(<event>, <event_data> , ack_callback);

                  Errata type: Code | Chapter number: 2

                  doctype 5 has been deprecated and now we should use doctype html 

                  Sorry, there are currently no downloads available for this title.

                  Frequently bought together

                  Socket.IO Real-time Web Application Development +    Piwik Web Analytics Essentials =
                  50% Off
                  the second eBook
                  Price for both: $31.45

                  Buy both these recommended eBooks together and get 50% off the cheapest eBook.

                  What you will learn from this book

                  • Establish a bidirectional connection in the  browser to the web server
                  • Develop a chat system using Node.js and socket.io
                  • Various methods of pushing information from the server to the browser
                  • Get familiar with socket.io API for cross-browser bidirectional communication
                  • Understand the socket.io protocol and its mechanics behind the scenes
                  • Get to know Socket.io messaging, events, sessions, authorization, namespaces, and rooms
                  • Cluster and distribute the socket.io sessions using redis session store

                  In Detail

                  The expectations of users for interactivity withweb applications have changed over the past few years. No more does the user want to press the refresh button to check if new messages have arrived in their inbox; people expect to see updates in their applications in real-time. Mass multiplayer online games have given up the requirement of plugins and are built entirely in JavaScript. Socket.io enables you to build these highly interactive applications that work cross-browser.

                  "Socket.io Real-time Web Application Development" is a guide to building, deploying, and scaling highly interactive real-time web applications using socket.io. This book will guide you through the building of a chat system using Node.js and socket.io, helping you get familiar with various features of the framework. Going further it will empower you to deploy and scale your applications in production.

                  Introducing web application development with Node.js, this book walks you through developing of a full-fledged chat system built with socket.io and introducing all the concepts of socket.io and its usage in the process.

                  It introduces you to the different approaches of bidirectional communication between the browser and the web server and will show you how socket.io abstracts all this for you to provide a single unified and uniform API for messaging and eventing to develop cross-browser applications. It explains how to authenticate your users, segregate the communication to channels, build chat rooms, and handle and scale sessions. It explains the mechanics behind socket.io and it also introduces you to what is involved in deploying the application to production and the intricacies involved in scaling it.

                  This book will introduce you to all that is needed in browser-server communication to develop the next generation of interactive applications and games.

                  Approach

                  Written in an engaging, easy-to-follow style, "Socket.io Real-time Web Application Development" is a practical guide for developing real-time web applications with Node.js and socket.io.

                  Who this book is for

                  This book is aimed at developers who want to start developing highly interactive and real-time web applications like chat systems or online multiplayer games, or want to introduce real-time updates or server push mechanisms in their existing applications. Knowledge of developing in JavaScript and web applications in general is expected. Though there is a chapter on introducing Node.js, prior knowledge of Node.js will be a plus.

                  Code Download and Errata
                  Packt Anytime, Anywhere
                  Register Books
                  Print Upgrades
                  eBook Downloads
                  Video Support
                  Contact Us
                  Awards Voting Nominations Previous Winners
                  Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
                  Resources
                  Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software