没有合适的资源?快使用搜索试试~ 我知道了~
首页构建实时用户体验:实操指南
"《实时用户体验:创建沉浸式和互动网站》(Building the Realtime User Experience: Creating Immersive and Interactive Websites)是由Ted Roden撰写的一本专业书籍,该书于2010年6月由O'Reilly出版社发行。书中探讨了在互联网日益实时化的背景下,如何构建满足用户即时需求的用户体验。作者强调了实时内容推送、动态网页元素、实时聊天、即时消息服务以及短信互动等技术的应用,并通过JavaScript和Python示例,指导读者逐步实现这些功能,包括利用PubSubHubbub进行实时订阅、在首页创建动态小部件显示实时更新、使用长轮询技术推送服务器内容至浏览器、构建基于Tornado的处理大量流式数据的应用,以及设置基本聊天服务的特殊要求和定制实时分析以衡量用户参与度。最后,全书以一个结合了所有讨论技术的地理位置感知游戏作为总结,帮助读者将理论知识应用于实际项目。这本书适合Web开发者和设计师,旨在提升网站的交互性和实时性能,适应社交媒体时代的用户期待。"
资源详情
资源推荐
What Is Realtime?
Since the explosion of the Web, developers have been inclined to think in terms of
building websites. Even in this book, I’ve spent a good deal of time writing about
building websites. But make no mistake about it, a realtime user experience does not
exist entirely inside a web browser.
The original web browsers were designed to load and display web pages. The idea of
a web page is quite similar to the printed page. It is a static document, stored in a
computer, but a static document nonetheless. The interface of web browsers evolved
to work within this paradigm. There is a Next button and a Back button designed
to take you from the current page to the page that you viewed previously. That
makes perfect sense when you’re working with documents. However, the Web is quite
quickly shifting away from a document-based paradigm to a web-based form of
communication.
It used to be that a web page was more or less published to the Web. A page was created
and given a specific URI, and when the user went to that page, it was pretty clear what
to expect. Now we have sites like Facebook where the same URL is not only different
for each of the hundreds of millions of different users, but it changes moments after a
user loads the page.
Changing Interactions
In the past, the interaction between a user and a web application was very simple. When
a user wanted content, she would load up her browser, point it at a URL, and get the
content (see Figure 1-1). If she wanted to write a blog post, she’d load up her browser,
fill out a form, and press submit. When she wanted to see comments, it was much the
same.
This has changed. No longer can a website wait for users to navigate to the right URL;
the website must contact the user wherever that user may be. The paradigm has shifted
from a website-centric model, where the website was at the center of the interaction,
to a user-centric model. Now all interactions start and end at the user (see Fig-
ure 1-2), whether she is visiting the website or sending in Short Message Service (SMS)
updates.
A truly realtime experience exists anywhere the user is at a given moment. If the user
is interacting with the web browser, then that’s the place to contact her. If she’s got her
instant messenger program open, she’d better be able to interact with your app from
that window. When she’s offline and your application has an important message for
her, send it via SMS. Naturally, you’ll need to ask the user’s permission before you do
some of these things, but your application needs to offer them.
2 | Chapter 1: Introduction
Figure 1-1. In the past, users visited websites
Figure 1-2. Websites must reach out to users wherever they are
What Is Realtime? | 3
I mentioned SMS, but the mobile experience does not end there. These days, users have
phones in their pockets with full-fledged web browsers that in some cases offer more
functionality than their desktop-based brethren. Among other things, mobile browsers
can handle offline data storage, GPS sensors, and touch-based interfaces. Their im-
pressive featureset, coupled with nearly ubiquitous wireless broadband, means they
cannot be treated as second class Internet citizens. Applications and user experiences
simply must be built with mobile devices in mind.
Push Versus Pull
For about as long as the Web has been around, there have been two main ways of
getting content to a user: push and pull. Pull is the method in which most interactions
have worked—the user clicks a link and the browser pulls the content down from the
server. If the server wants to send additional messages to the user after the data has
been pulled down, it just waits and queues them up until the client makes another
request. The idea behind push technology is that as soon as the server has a new message
for the user, it sends it to him immediately. A connection is maintained between the
server and the client and new data is sent as needed.
In the scheme of the Internet, push technology is not a new development. Throughout
the years there have been different standards dictating how it should work. Each pro-
posed standard has had varying levels of support amongst browser makers and different
requirements on the server side.
The differing behaviors and requirements of the two technologies have led many de-
velopers to use one or the other. This has meant that many sites wanting to offer dy-
namic updates to their users had to resort to Ajax timers polling the site every X seconds
to check for new content. This increased amount of requests is taxing on the server and
provides a far less graceful user experience than it should have.
Pushing content out to the user as it happens gives the user a much more engaging
experience and uses far less resources on the server. Fewer requests means less band-
width is used and less CPU consumed, because the server is not constantly checking
and responding to update requests (see Figure 1-3).
Prerequisites
This book assumes the reader is comfortable with most aspects of web development.
The example code in this text uses Java, JavaScript, PHP, and Python. You are encour-
aged to use the technologies that make the most sense to you. If you’re more comfort-
able with PostgreSQL than MySQL, please use what you’re more familiar with. Many
of the command-line examples assume you’re using something Unix-like (Mac OS X,
Linux, etc.), but most of this software runs on Windows, and I’m confident that you
can translate any commands listed so that they work in your environment.
4 | Chapter 1: Introduction
Building a realtime user experience is language agnostic, and in this book, I’ve chosen
to use several
different languages in the examples. Some examples use several technol-
ogies chained together. If you’re not familiar with one language, don’t worry about it.
Much of the code is written so you can read it if you’re familiar with basic programming
practices, plus I’ve done my best to explain it in the text.
Figure 1-3. Visualizing push versus pull
Prerequisites | 5
Another prerequisite for this book is a Google account. Several of the examples require
a Google account for App Engine, whereas others use it for authentication. Where it’s
used for authentication, you could fairly easily drop in authentication from another
third-party site.
Python
Python is the most-used language in this book for a couple of reasons. Whether or not
you know Python, it’s a very simple language to read on the page. It also has a couple
of terrific libraries that are used throughout this book. During the process of writing
this text, one of the pioneers on the realtime web, FriendFeed, was sold to Facebook.
After the acquisition, Facebook released a core piece of FriendFeed’s infrastructure as
open source software called Tornado, which is both a collection of libraries and a web
server.
JavaScript
This book uses JavaScript in many of the chapters. In most chapters I use a library that
helps with some cross-browser issues and enables the examples to contain less code by
wrapping up some common activities into simple function calls. This was done to save
space on the page and make things easier. If you have a preference of mootools.com or
any other JavaScript library over jQuery, please go ahead and use those. These examples
are not based around the languages.
JavaScript Object Notation
This book heavily uses JavaScript Object Notation (JSON) in a number of the examples.
JSON is a simple, lightweight data interchange format. It’s often used as the payload
from Application Programming Interface (API) calls to external services, but in this
book it’s also used to send messages to the server and back to the browser.
Google’s App Engine
Another technology that is used in several chapters is Google’s App Engine platform.
This service is Google’s entry into the cloud computing services industry. It’s a fairly
unique way of looking at serving applications, and the developer does not have to think
about scaling up by adding servers. It’s useful here because it gives us a lot of standard
features for free. There is a datastore, authentication, and integration with other serv-
ices, all without paying a cent or writing much complicated code. It was also picked
because it requires almost no configuration for the developer. If you’re not familiar with
the service, that is no problem, because we go through the process of setting up an
account in the text.
6 | Chapter 1: Introduction
剩余320页未读,继续阅读
huzhouhzy
- 粉丝: 83
- 资源: 1948
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 十种常见电感线圈电感量计算公式详解
- 军用车辆:CAN总线的集成与优势
- CAN总线在汽车智能换档系统中的作用与实现
- CAN总线数据超载问题及解决策略
- 汽车车身系统CAN总线设计与应用
- SAP企业需求深度剖析:财务会计与供应链的关键流程与改进策略
- CAN总线在发动机电控系统中的通信设计实践
- Spring与iBATIS整合:快速开发与比较分析
- CAN总线驱动的整车管理系统硬件设计详解
- CAN总线通讯智能节点设计与实现
- DSP实现电动汽车CAN总线通讯技术
- CAN协议网关设计:自动位速率检测与互连
- Xcode免证书调试iPad程序开发指南
- 分布式数据库查询优化算法探讨
- Win7安装VC++6.0完全指南:解决兼容性与Office冲突
- MFC实现学生信息管理系统:登录与数据库操作
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功