WebSocket Essentials – Building Apps with HTML5 WebSockets
By Varun Chopra
()
About this ebook
- Learn to build your real-time collaborative application for mobiles and tablets using WebSockets
- Set up your own WebSocket server and familiarize yourself with the combined power of WebSockets with HTML5
- A practical guide, accompanied by examples, which will help you to understand the working of the Node.js WebSocket server
This book is for web developers who want to learn and implement WebSocket to create interesting apps for modern browsers, leveraging the capabilities of HTML5 with WebSockets.
Related to WebSocket Essentials – Building Apps with HTML5 WebSockets
Related ebooks
Building Modern Serverless Web APIs: Develop Microservices and Implement Serverless Applications with .NET Core 3.1 and AWS Lambda (English Edition) Rating: 0 out of 5 stars0 ratingsBuilding Scalable Apps with Redis and Node.js Rating: 0 out of 5 stars0 ratingsReact Components Rating: 0 out of 5 stars0 ratingsReact Projects: Build 12 real-world applications from scratch using React, React Native, and React 360 Rating: 0 out of 5 stars0 ratingsGetting Started with WebRTC Rating: 0 out of 5 stars0 ratingsASP.NET Core 3 and React: Hands-On full stack web development using ASP.NET Core, React, and TypeScript 3 Rating: 0 out of 5 stars0 ratingsNode.js By Example Rating: 2 out of 5 stars2/5JavaScript Security Rating: 4 out of 5 stars4/5Node Web Development, Second Edition Rating: 0 out of 5 stars0 ratingsBuilding a RESTful Web Service with Spring Rating: 5 out of 5 stars5/5ASP.NET Web API Security Essentials Rating: 0 out of 5 stars0 ratingsJasmine JavaScript Testing - Second Edition Rating: 0 out of 5 stars0 ratingsDeploying Node.js Rating: 5 out of 5 stars5/5ReactJS for Jobseekers: The Only Guide You Need to Learn React and Crack Interviews (English Edition) Rating: 0 out of 5 stars0 ratingsHands-On Microservices with Kubernetes: Build, deploy, and manage scalable microservices on Kubernetes Rating: 5 out of 5 stars5/5Mastering Spring 5.0 Rating: 5 out of 5 stars5/5Mastering Symfony Rating: 0 out of 5 stars0 ratingsMastering JavaScript Design Patterns - Second Edition Rating: 5 out of 5 stars5/5Monitoring Docker Rating: 0 out of 5 stars0 ratingsLearning Node.js for Mobile Application Development Rating: 0 out of 5 stars0 ratingsGetting Started with React Rating: 0 out of 5 stars0 ratingsBuilding Single-page Web Apps with Meteor Rating: 5 out of 5 stars5/5Opa Application Development Rating: 0 out of 5 stars0 ratingsGradle in Action Rating: 4 out of 5 stars4/5Testing Vue.js Applications Rating: 0 out of 5 stars0 ratingsTest-Driven JavaScript Development Rating: 0 out of 5 stars0 ratingsRust In Practice Rating: 0 out of 5 stars0 ratings
Programming For You
Learn to Code. Get a Job. The Ultimate Guide to Learning and Getting Hired as a Developer. Rating: 5 out of 5 stars5/5Python Programming : How to Code Python Fast In Just 24 Hours With 7 Simple Steps Rating: 4 out of 5 stars4/5Coding All-in-One For Dummies Rating: 4 out of 5 stars4/5HTML & CSS: Learn the Fundaments in 7 Days Rating: 4 out of 5 stars4/5Grokking Algorithms: An illustrated guide for programmers and other curious people Rating: 4 out of 5 stars4/5SQL: For Beginners: Your Guide To Easily Learn SQL Programming in 7 Days Rating: 5 out of 5 stars5/5SQL QuickStart Guide: The Simplified Beginner's Guide to Managing, Analyzing, and Manipulating Data With SQL Rating: 4 out of 5 stars4/5Excel : The Ultimate Comprehensive Step-By-Step Guide to the Basics of Excel Programming: 1 Rating: 5 out of 5 stars5/5Python QuickStart Guide: The Simplified Beginner's Guide to Python Programming Using Hands-On Projects and Real-World Applications Rating: 0 out of 5 stars0 ratingsLearn PowerShell in a Month of Lunches, Fourth Edition: Covers Windows, Linux, and macOS Rating: 0 out of 5 stars0 ratingsPYTHON: Practical Python Programming For Beginners & Experts With Hands-on Project Rating: 5 out of 5 stars5/5Photoshop For Beginners: Learn Adobe Photoshop cs5 Basics With Tutorials Rating: 0 out of 5 stars0 ratingsMastering Windows PowerShell Scripting Rating: 4 out of 5 stars4/5The Absolute Beginner's Guide to Binary, Hex, Bits, and Bytes! How to Master Your Computer's Love Language Rating: 5 out of 5 stars5/5Learn JavaScript in 24 Hours Rating: 3 out of 5 stars3/5Hacking: Ultimate Beginner's Guide for Computer Hacking in 2018 and Beyond: Hacking in 2018, #1 Rating: 4 out of 5 stars4/5Python Machine Learning By Example Rating: 4 out of 5 stars4/5Problem Solving in C and Python: Programming Exercises and Solutions, Part 1 Rating: 5 out of 5 stars5/5Programming Arduino: Getting Started with Sketches Rating: 4 out of 5 stars4/5OneNote: The Ultimate Guide on How to Use Microsoft OneNote for Getting Things Done Rating: 1 out of 5 stars1/5SQL All-in-One For Dummies Rating: 3 out of 5 stars3/5Modern C++ for Absolute Beginners: A Friendly Introduction to C++ Programming Language and C++11 to C++20 Standards Rating: 0 out of 5 stars0 ratings
Reviews for WebSocket Essentials – Building Apps with HTML5 WebSockets
0 ratings0 reviews
Book preview
WebSocket Essentials – Building Apps with HTML5 WebSockets - Varun Chopra
Table of Contents
WebSocket Essentials – Building Apps with HTML5 WebSockets
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Introducing the World of Web App
What is the Web?
Web applications
Where does WebSockets fit?
WebSockets over other methods
Modern browsers
HTML
HTML5 – the modern Web standard
Media – audio/video
Canvas
Form elements
Semantics
Mobile first
Offline storage
Geolocation
Drag and drop
Web workers
JavaScript
Modern servers
WebSockets
Summary
2. Getting Started with WebSockets
Why WebSockets?
Importance of WebSockets
When to use?
How it works?
WebSocket API
Ready states
Events
Echo Test
The WebSockets client app
Instantiation
Adding events
Sending messages
Receiving messages
Closing the connection
The WebSocket server
The Node.js server
Summary
3. Configuring the Server and Transferring Real-time Data
Full-duplex real-time data transfer
Foundation of real-time applications
Collaborative presentation application
The presentation library
Setting up the library
Adding collaboration
Code implementation
The client code
Code explanation
The server code
Code explanation
Do it yourself
Input username
The list of users
User-based authorization to change the presentation
Making the user the presenter
Tips and tricks
Summary
4. Using WebSockets in Real Scenario
The real scenario
The JavaScript framework
AngularJS
Learn by doing
The collaborative drawing application
Requirements
The drawing library
The client application
Integrating with the server
The client code
Code explanation
The server code
Code explanation
Do it yourself
User registration
The list of users
Share with specific users
Save drawings
The application structure
Restructure the application
Model
View
Controller
Service
Summary
5. WebSockets for Mobile and Tablet
Mobile devices and the WebSocket
Pusher
Socket.IO
Running server on mobile
Local server on mobile
Mobile output
Browser support
Do it yourself
Scenario 1
Scenario 2
Scenario 3
Summary
6. Enhancing HTML5 Web Application Development Using Modern Tools
Modern tools and techniques
Code editors
Boilerplates
Packaging tools
Build tools
Application frameworks
Modern servers
Responsive web design
The MEAN stack
Summary
Index
WebSocket Essentials – Building Apps with HTML5 WebSockets
WebSocket Essentials – Building Apps with HTML5 WebSockets
Copyright © 2015 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: April 2015
Production reference: 1270415
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78439-675-6
www.packtpub.com
Credits
Author
Varun Chopra
Reviewers
Adir Amsalem
Sann-Remy Chea
Commissioning Editor
Amarabha Banerjee
Acquisition Editor
Sonali Vernekar
Content Development Editor
Mamata Walkar
Technical Editor
Siddhesh Patil
Copy Editors
Puja Lalwani
Vikrant Phadke
Project Coordinator
Shipra Chawhan
Proofreaders
Safis Editing
Paul Hindle
Indexer
Monica Mehta
Production Coordinator
Aparna Bhagat
Cover Work
Aparna Bhagat
About the Author
Varun Chopra has a lot of experience in the design and development of enterprise applications. He has worked as a consultant and has extensive experience in integrating different technologies. Besides his love of technology, he is also a singer and a guitarist and loves gadgets.
About the Reviewers
Adir Amsalem is a software engineer from Israel. Since the age of 16, he has loved developing websites and web apps, reading about technology, and solving technological challenges. He currently works for a major financial institution, where he leads web and frontend development of several products. Previously, he was a web developer and frontend developer at several Israeli companies and was also a freelancer.
Sann-Remy Chea works as a software engineer at Ubisoft Owlient, a video game company specializing in web and mobile games, based in Paris, France. He has also worked at IBM as an application architect intern. Fond of web application development, he specializes in JavaScript and Node.js.
www.PacktPub.com
Support files, eBooks, discount offers, and more
For support files and downloads related to your book, please visit www.PacktPub.com.
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at
At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.
https://www2.packtpub.com/books/subscription/packtlib
Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can search, access, and read Packt's entire library of books.
Why subscribe?
Fully searchable across every book published by Packt
Copy and paste, print, and bookmark content
On demand and accessible via a web browser
Free access for Packt account holders
If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view 9 entirely free books. Simply use your login credentials for immediate access.
Preface
HTML, the most important part of web development, was lacking somewhere, but now developers are returning to HTML5 because of its enhancements and features, giving them a new experience of development. WebSocket support on different browsers made it easier to develop web applications with a lot of features.
Data communication between the client and the server is one of the most important parts of any web application. Almost all browsers support WebSockets, which makes it more powerful and available. Developers always want to build their application on a concrete ground so that it is reliable for users. WebSocket makes this possible now. With HTML5 enhancements, it is being accepted and appreciated widely