没有合适的资源?快使用搜索试试~ 我知道了~
首页The Definitive Guide to HTML5 WebSocket 无水印原版pdf
The Definitive Guide to HTML5 WebSocket 无水印原版pdf
需积分: 10 114 浏览量
更新于2023-03-16
评论
收藏 6.03MB PDF 举报
The Definitive Guide to HTML5 WebSocket 英文无水印原版pdf pdf所有页面使用FoxitReader、PDF-XChangeViewer、SumatraPDF和Firefox测试都可以打开 本资源转载自网络,如有侵权,请联系上传者或csdn删除 查看此书详细信息请在美国亚马逊官网搜索此书
资源详情
资源评论
资源推荐

v
Contents at a Glance
Foreword ���������������������������������������������������������������������������������������� xiii
About the Authors ���������������������������������������������������������������������������� xv
About the Technical Reviewer ������������������������������������������������������� xvii
Acknowledgments �������������������������������������������������������������������������� xix
Chapter 1: Introduction to HTML5 WebSocket ■ �������������������������������� 1
Chapter 2: The WebSocket API ■ ����������������������������������������������������� 13
Chapter 3: The WebSocket Protocol ■ ��������������������������������������������� 33
Chapter 4: Building Instant Messaging and Chat ■
over WebSocket with XMPP ��������������������������������������������������������� 61
Chapter 5: Using Messaging over WebSocket with STOMP ■ ���������� 85
Chapter 6: VNC with the Remote Framebuffer Protocol ■ ������������� 109
Chapter 7: WebSocket Security ■ �������������������������������������������������� 129
Chapter 8: Deployment Considerations ■ �������������������������������������� 149
Appendix A: Inspecting WebSocket Traffic ■ ��������������������������������� 163
Appendix B: WebSocket Resources ■ �������������������������������������������� 177
Index ���������������������������������������������������������������������������������������������� 183

1
Chapter 1
Introduction to HTML5
WebSocket
This book is for anyone who wants to learn how to build real-time web applications.
You might say to yourself, “I already do that!” or ask “What does that really mean?” Let’s
clarify: this book will show you how to build truly real-time web applications using a
revolutionary new and widely supported open industry standard technology called
WebSocket, which enables full-duplex, bidirectional communication between your client
application and remote servers over the Web—without plugins!
Still confused? So were we a few years ago, before we started working with HTML5
WebSocket. In this guide, we’ll explain what you need to know about WebSocket, and
why you should be thinking about using WebSocket today. We will show you how to
implement a WebSocket client in your web application, create your own WebSocket
server, use WebSocket with higher-level protocols like XMPP and STOMP, secure traffic
between your client and server, and deploy your WebSocket-based applications. Finally,
we will explain why you should be thinking about using WebSocket right now.
What is HTML5?
First, let’s examine the “HTML5” part of “HTML5 WebSocket.” If you’re already an expert
with HTML5, having read, say, Pro HTML5 Programming, and are already developing
wonderfully modern and responsive web applications, then feel free to skip this section
and read on. But, if you’re new to HTML5, here’s a quick introduction.
HTML was originally designed for static, text-based document sharing on the
Internet. Over time, as web users and designers wanted more interactivity in their HTML
documents, they began enhancing these documents, by adding form functionality and
early “portal” type capabilities. Now, these static document collections, or web sites,
are more like web applications, based on the principles of rich client/server desktop
applications. These web applications are being used on almost any device: laptops, smart
phones, tablets—the gamut.
HTML5 is designed to make the development of these rich web applications easier,
more natural, and more logical, where developers can design and build once, and deploy
anywhere. HTML5 makes web applications more usable, as well, as it removes the need
for plugins. With HTML5, you now use semantic markup language like <header> instead
of <div class="header">. Multimedia is also much easier to code, by using tags like

CHAPTER 1 ■ INTRODUCTION TO HTML5 WEBSOCKET
2
Figure 1-1. HTML5 feature areas (W3C, 2011)
<audio> and <video> to pull in and assign the appropriate media type. Additionally, by
being semantic, HTML5 is more accessible, since screen readers can more easily read
its tags.
HTML5 is an umbrella term that covers the large number of improvements and
changes happening in web technologies, and includes everything from the markup you
use on your web pages to the CSS3 styling, offline and storage, multimedia, connectivity,
and so on. Figure 1-1 shows the different HTML5 feature areas.
There are lots of resources that delve into these areas of HTML5. In this book, we
focus on the Connectivity area, namely the WebSocket API and protocol. Let’s take a look
at the history of HTML5 connectivity.
HTML5 Connectivity
The Connectivity area of HTML5 includes technologies like WebSocket, Server-Sent
Events, and Cross-Document Messaging. These APIs were included in the HTML5
specification to help simplify some of the areas where browser limitations prevented
web application developers from creating the rich behavior they desired or where web
application development was becoming overly complex. One example of simplification in
HTML5 is Cross-Document Messaging.
Before HTML5, communication between browser windows and frames was
restricted for security reasons. However, as web applications started to bring together
content and applications from different web sites, it became necessary for those
applications to communicate with each other. To address this, standards bodies and
major browser vendors agreed to support Cross-Document Messaging, which enables
secure cross-origin communication across browser windows, tabs, and iFrames. Cross-
Document Messaging defines the postMessage API as a standard way to send and receive
messages. There are many use cases for consuming content from different hosts and
domains—such as mapping, chat, and social networks—to communicate inside the web
剩余199页未读,继续阅读














安全验证
文档复制为VIP权益,开通VIP直接复制

评论0