O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

WebSocket Essentials – Building Apps with HTML5 WebSockets

Book Description

Build your own real-time web applications using HTML5 WebSockets

In Detail

WebSocket facilitates complete duplex communication between the client and server. HTML5 made it possible to create enterprise-level applications considering the important parameters related to application maintainability. All these enhanced features help developers to remove the dependency on different plugins.

Starting with the basics of HTML5, you will work your way through the process of implementing different applications using WebSockets and HTML5 using the Node.js server. You will explore how to use WebSockets on the mobile and tablet platforms and build a real-time drawing application in HTML5 utilizing WebSockets. You will also learn how to set up the Node.js server and develop an app for presentation sharing.

By the end of this book, you will be familiar with the technology and will have learned how to enhance your HTML5 web application development using modern tools.

What You Will Learn

  • Create a web app with the advanced features of the modern Web
  • Expand the level of application by using different frameworks and libraries
  • Improve HTML5 web application development with the help of up-to-date tools
  • Structure your application and speed up development with modern tools
  • Develop a WebSocket server using Node.js
  • Discover all the basics of using WebSockets on mobile and tablet platforms
  • Transmit real-time data between users by building a drawing application in HTML5
  • Understand the importance of using framework AngularJS along with Bootstrap

Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.

Table of Contents

  1. WebSocket Essentials – Building Apps with HTML5 WebSockets
    1. Table of Contents
    2. WebSocket Essentials – Building Apps with HTML5 WebSockets
    3. Credits
    4. About the Author
    5. About the Reviewers
    6. www.PacktPub.com
      1. Support files, eBooks, discount offers, and more
        1. Why subscribe?
        2. Free access for Packt account holders
    7. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Downloading the example code
        2. Errata
        3. Piracy
        4. Questions
    8. 1. Introducing the World of Web App
      1. What is the Web?
      2. Web applications
      3. Where does WebSockets fit?
      4. WebSockets over other methods
      5. Modern browsers
      6. HTML
      7. HTML5 – the modern Web standard
        1. Media – audio/video
        2. Canvas
        3. Form elements
        4. Semantics
        5. Mobile first
        6. Offline storage
        7. Geolocation
        8. Drag and drop
        9. Web workers
        10. JavaScript
        11. Modern servers
        12. WebSockets
      8. Summary
    9. 2. Getting Started with WebSockets
      1. Why WebSockets?
      2. Importance of WebSockets
      3. When to use?
      4. How it works?
      5. WebSocket API
        1. Ready states
        2. Events
      6. Echo Test
      7. The WebSockets client app
        1. Instantiation
        2. Adding events
        3. Sending messages
        4. Receiving messages
        5. Closing the connection
      8. The WebSocket server
        1. The Node.js server
      9. Summary
    10. 3. Configuring the Server and Transferring Real-time Data
      1. Full-duplex real-time data transfer
      2. Foundation of real-time applications
      3. Collaborative presentation application
        1. The presentation library
        2. Setting up the library
        3. Adding collaboration
        4. Code implementation
          1. The client code
            1. Code explanation
          2. The server code
            1. Code explanation
      4. Do it yourself
        1. Input username
        2. The list of users
        3. User-based authorization to change the presentation
        4. Making the user the presenter
      5. Tips and tricks
      6. Summary
    11. 4. Using WebSockets in Real Scenario
      1. The real scenario
      2. The JavaScript framework
        1. AngularJS
      3. Learn by doing
      4. The collaborative drawing application
        1. Requirements
          1. The drawing library
        2. The client application
        3. Integrating with the server
          1. The client code
            1. Code explanation
          2. The server code
            1. Code explanation
      5. Do it yourself
        1. User registration
        2. The list of users
        3. Share with specific users
        4. Save drawings
      6. The application structure
      7. Restructure the application
        1. Model
        2. View
        3. Controller
        4. Service
      8. Summary
    12. 5. WebSockets for Mobile and Tablet
      1. Mobile devices and the WebSocket
        1. Pusher
        2. Socket.IO
      2. Running server on mobile
        1. Local server on mobile
          1. Mobile output
      3. Browser support
      4. Do it yourself
        1. Scenario 1
        2. Scenario 2
        3. Scenario 3
      5. Summary
    13. 6. Enhancing HTML5 Web Application Development Using Modern Tools
      1. Modern tools and techniques
        1. Code editors
        2. Boilerplates
        3. Packaging tools
        4. Build tools
        5. Application frameworks
        6. Modern servers
        7. Responsive web design
        8. The MEAN stack
      2. Summary
    14. Index