ORACLE FL / Java WebSocket Programming / Danny Coward / 719-6 / FM Java WebSocketProgramming 00-FM.indd 1 8/8/13 11:40 AM ORACLE FL / Java WebSocket Programming / Danny Coward / 719-6 / FM About the AuthorDanny Coward is a Chief Architect and Web Architect at Oracle. He is the Specification Lead for the Java API for WebSocket for Java EE and Java SE/ JavaFX. Cowards work leading WebSockets at Oracle makes him the leading expert on Java WebSocket programming. Coward has specialized experience in all aspects of Java softwarefrom Java ME to Java EE to the founding of the JavaFX technology. About the Technical EditorDr. Santiago Pericas-Geertsen is a Principal Member of Technical Staff in the Sun Glassfish organization at Oracle, and an architect and technical lead in the Avatar project.
Santiago is a Specification Lead for JSR 339, JAX-RS 2.0. While at Sun Microsystems, Santiago was a technical lead for the Glassfish Mobility Platform, a developer and lead in the Fast Web Services project, and a participant and editor in World Wide Web Consortium (W3C) initiatives. He holds two US patents, 7647415 and 7716577. Santiago blogs from Java.net, tweets from @spericas, and has presented at numerous academic and industry-oriented conferences. 00-FM.indd 2 8/7/13 5:59 PM ORACLE FL / Java WebSocket Programming / Danny Coward / 719-6 / FM Java WebSocketProgramming Danny Coward New York Chicago San Francisco Athens London Madrid Mexico City Milan New Delhi Singapore Sydney Toronto 00-FM.indd 3 8/8/13 12:06 PM Copyright 2014 by McGraw-Hill Education (Publisher). All rights reserved.
Printed in the United States of America. Except as permitted under the Copyright Act of 1976, no part of this publication may be reproduced or distributed in any form or by any means, or stored in a database or retrieval system, without the prior written permission of publisher, with the exception that the program listings may be entered, stored, and executed in a computer system, but they may not be reproduced for publication. ISBN: 978-0-07-182718-8 MHID: 0-07-182718-8 e-book conversion by Cenveo Publisher Services Version 1.0 The material in this e-book also appears in the print version of this title: ISBN: 978-0-07-182719-5, MHID: 0-07-182719-6 McGraw-Hill Education e-books are available at special quantity discounts to use as premiums and sales promotions, or for use in corporate training programs. To contact a representative, please visit the Contact Us pages at www.mhprofessional.com. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. All other trademarks are the property of their respective owners, and McGraw-Hill Education makes no claim of ownership by the mention of products that contain these marks.
Screen displays of copyrighted Oracle software programs have been reproduced herein with the permission of Oracle Corporation and/or its affiliates. Information has been obtained by McGraw-Hill Education from sources believed to be reliable. However, because of the possibility of human or mechanical error by our sources, McGraw-Hill Education, or others, McGraw-Hill Education does not guarantee the accuracy, adequacy, or completeness of any information and is not responsible for any errors or omissions or the results obtained from the use of such information. Oracle Corporation does not make any representations or warranties as to the accuracy, adequacy, or completeness of any information contained in this Work, and is not responsible for any errors or omissions. TERMS OF USE This is a copyrighted work and McGraw-Hill Education (McGraw-Hill) and its licensors reserve all rights in and to the work. Use of this work is subject to these terms.
Except as permitted under the Copyright Act of 1976 and the right to store and retrieve one copy of the work, you may not decompile, disassemble, reverse engineer, reproduce, modify, create derivative works based upon, transmit, distribute, disseminate, sell, publish or sublicense the work or any part of it without McGraw-Hills prior consent. You may use the work for your own noncommercial and personal use; any other use of the work is strictly prohibited. Your right to use the work may be terminated if you fail to comply with these terms. THE WORK IS PROVIDED AS IS. McGRAW-HILL AND ITS LICENSORS MAKE NO GUARANTEES OR WARRANTIES AS TO THE ACCURACY, ADEQUACY OR COMPLETENESS OF OR RESULTS TO BE OBTAINED FROM USING THE WORK, INCLUDING ANY INFORMATION THAT CAN BE ACCESSED THROUGH THE WORK VIA HYPERLINK OR OTHERWISE, AND EXPRESSLY DISCLAIM ANY WARRANTY, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. McGraw-Hill and its licensors do not warrant or guarantee that the functions contained in the work will meet your requirements or that its operation will be uninterrupted or error free.
Neither McGraw-Hill nor its licensors shall be liable to you or anyone else for any inaccuracy, error or omission, regardless of cause, in the work or for any damages resulting therefrom. McGraw-Hill has no responsibility for the content of any information accessed through the work. Under no circumstances shall McGraw-Hill and/or its licensors be liable for any indirect, incidental, special, punitive, consequential or similar damages that result from the use of or inability to use the work, even if any of them has been advised of the possibility of such damages. This limitation of liability shall apply to any claim or cause whatsoever whether such claim or cause arises in contract, tort or otherwise. eBook 719-6cr_pg.indd 1 8/8/13 4:33 PM ORACLE FL / Java WebSocket Programming / Danny Coward / 719-6 / FM This book is dedicated to Bill, Jared, and Alex. xiii 00-FM.indd 13 8/7/13 5:59 PM ORACLE FL / Java WebSocket Programming / Danny Coward / 719-6 / FM This page has been intentionally left blank 00-FM.indd 14 8/7/13 5:59 PM ORACLE FL / Java WebSocket Programming / Danny Coward / 719-6 / FM IntroductionThe WebSocket protocol is a new networking protocol for web developers burgeoning toolbox. xiii 00-FM.indd 13 8/7/13 5:59 PM ORACLE FL / Java WebSocket Programming / Danny Coward / 719-6 / FM This page has been intentionally left blank 00-FM.indd 14 8/7/13 5:59 PM ORACLE FL / Java WebSocket Programming / Danny Coward / 719-6 / FM IntroductionThe WebSocket protocol is a new networking protocol for web developers burgeoning toolbox.
Aside from its inclusion as a core technology in HTML5 and its rapid adoption by all the major browsers from desktop to tablets and smartphones, why would the web developer care about yet another web technology? The Long Poll By 2000, most major corporations worldwide had some kind of web presence. In the developing world, the personal computer revolution resulted in most households having Internet access through at least one channel. Businesses were rapidly building their presences on the Internet as a means of showcasing their products and services, and as a growing channel through which to deliver them. The basic technologies of the Web, such as HTTP, HTML, and JavaScript, were powering a revolution in how people interacted with one other, with their schools, and with their places of work; how they planned vacations; and even how they bought groceries. Web sites grew from static and colorless catalog-style first efforts as developers sought new ways to make the web sites more interactive. They looked to add life to their web sites by injecting interesting information to their viewer at appropriate times and updating the information on the page as necessary.
Next page