Book Image

Websocket Essentials: Building apps with HTML5 websockets

By : Varun Chopra
Book Image

Websocket Essentials: Building apps with HTML5 websockets

By: Varun Chopra

Overview of this book

Table of Contents (13 chapters)
WebSocket Essentials – Building Apps with HTML5 WebSockets
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
6
Enhancing HTML5 Web Application Development Using Modern Tools
Index

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 in the community.

In this book, you will learn and understand how WebSockets with HTML5 can create great applications, especially applications where data needs to be pushed from both the client side and the server side. With some basic sample applications that we will create in this book, you will understand how the client can be set up and how the Node.js-based WebSocket server can be created with ease.

This book is for developers who want to learn to create WebSocket-based applications. It gives you real-world scenarios for implementing different aspects of communication with WebSockets. It is simple to learn and easy to understand.

What this book covers

Chapter 1, Introducing the World of Web App, is an introduction to web applications, covering the basics of the Web. This chapter introduces HTML5, its new features and WebSockets.

Chapter 2, Getting Started with WebSockets, covers WebSockets in depth, including the benefits of WebSockets and how to create a sample application. Here, you learn to create your own basic WebSocket server using the Node.js platform.

Chapter 3, Configuring the Server and Transferring Real–time Data, shows how data can be sent across different users connected to the server using WebSockets. This chapter also covers the creation of an application using the JavaScript library to share a presentation and collaboratively change slides between different users.

Chapter 4, Using WebSockets in Real Scenario, demonstrates another application to explain more about how WebSockets can be used in real-world scenarios. This chapter also talks about the JavaScript framework and its uses.

Chapter 5, WebSockets for Mobile and Tablet, covers how WebSockets behaves with mobile devices, different libraries for mobile WebSockets, running the server on an Android mobile phone, and the use of the Express.js package for delivering content from within the server.

Chapter 6, Enhancing HTML5 Web Application Development Using Modern Tools, explains different tools and techniques that can be used to enhance web application development. This chapter illustrates speeding up development using different tools such as editors, package mangers, version control, boilerplates, application frameworks, responsive web design, and more.

What you need for this book

You will need a machine that has a modern browser installed on it, primarily a browser that supports WebSockets and HTML5. You'll also require a text editor, such as Sublime Text. Further, it is necessary to install Node.js if you don't have it.

To check whether your browser supports WebSockets and HTML5 or not, go to http://www.caniuse.com.

Who this book is for

This book is for web developers with a basic knowledge of HTML and JavaScript. It focuses on implementing different applications and gives hands-on experience to developers. It is a fast book and it equips you with the necessary tools and techniques for developing WebSocket-based applications.

Conventions

In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "Here, Host is the name of the server that we are hitting."

A block of code is set as follows:

<html>

<head>
<meta charset="utf-8" >
<title>WebSocket Test</title>
<script language="javascript" type="text/javascript">
var wsUri = "ws://echo.websocket.org/";
var output;

New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "Take a look at the Console log in the left-hand-side window."

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of.

To send us general feedback, simply e-mail , and mention the book's title in the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files from your account at http://www.packtpub.com for all the Packt Publishing books you have purchased. 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.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.

To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.

Piracy

Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors and our ability to bring you valuable content.

Questions

If you have a problem with any aspect of this book, you can contact us at , and we will do our best to address the problem.