Java WebSocket Programming

Book description

Master Application Development with Java WebSocket

Build dynamic enterprise Web applications that fully leverage state-of-the-art communication technologies. Written by the leading expert on Java WebSocket programming, this Oracle Press guide offers practical development strategies and detailed example applications. Java WebSocket Programming explains how to design client/server applications, incorporate full-duplex messaging, establish connections, create endpoints, handle path mapping, and secure data. You’ll also learn how to encrypt Web transmissions and enrich legacy applications with Java WebSocket.

  • Develop Web applications using the Java WebSocket API
  • Create and publish annotated and programmatic endpoints
  • Manage the lifecycle events of WebSocket endpoints
  • Maintain reliable connections across the endpoint lifecycle
  • Manage synchronous and asynchronous messaging
  • Define encoding and decoding strategies for complex messaging
  • Configure message timeouts, size limits, and exceptions
  • Map message paths and route incoming URIs to Web containers
  • Secure data, authenticate users, and encrypt connections

Table of contents

  1. Cover 
  2. About the Author
  3. Title Page
  4. Copyright Page
  5. Contents at a Glance
  6. Contents 
  7. Acknowledgments
  8. Introduction
  9. Chapter 1: Java WebSocket Fundamentals
    1. Creating Your First WebSocket Application
      1. Creating a WebSocket Endpoint
      2. Deploying the Endpoint
      3. Creating a WebSocket Client
    2. WebSocket Endpoints
    3. Programmatic Endpoints
      1. Fundamental Java WebSocket API Objects
    4. Inside the Echo Samples
      1. Deployment Phase
      2. Accepting the First Connection
      3. WebSocket Messaging
    5. Summary
  10. Chapter 2: Java WebSocket Lifecycle
    1. The WebSocket Protocol
    2. Lifecycle of a Java WebSocket
    3. The WebSocket Lifecycle in the Java WebSocket API
      1. Annotated Endpoint Event Handling
      2. Lifecycle Sample
      3. Programmatic Endpoint Lifecycle
      4. Number of Instances and Threading
    4. Summary
  11. Chapter 3: Basic Messaging
    1. Messaging Overview
      1. Sending Messages
      2. Receiving WebSocket Messages
    2. DrawingBoard Application
      1. DrawingBoard Client
    3. Messaging and Threading
      1. WebSocket Endpoint Threading and Messaging
      2. Threading and Lifecycle of Encoders and Decoders
    4. Summary
  12. Chapter 4: Configurations and Sessions
    1. Session State and Logical Endpoint State
    2. The Chat Sample
    3. Configuring Endpoints: ClientEndpointConfig and ServerEndpointConfig
      1. Supplying and Accessing Endpoint Configuration Information
      2. Examining the Configuration Options
      3. WebSocket Subprotocols and WebSocket Extensions
    4. The WebSocket Session
      1. The Lifecycle of the WebSocket Session
    5. Summary
  13. Chapter 5: Advanced Messaging
    1. Checking Up on Your Connection: Pings and Pongs
    2. Sending WebSocket Messages Asynchronously
      1. Sending a WebSocket Message by Future
      2. Sending a WebSocket Message with Handler
      3. When to Send By Future and When to Send with Handler?
      4. Asynchronous Send Timeouts
    3. Message Batching
    4. Buffering, Partial Messages, and Data Framing
    5. Guaranteeing Message Delivery
    6. Sending Messages API Summary
    7. The MessageModes Application
      1. Overview of the MessageModes Application
      2. Looking at the Code for the MessageModes Application
      3. Things to Notice About the MessageModes Application
    8. Summary
  14. Chapter 6: WebSocket Path Mapping
    1. Terminology of URIs
    2. WebSocket Path Mapping
      1. Exact URI Mapping
      2. URI Template Paths
      3. APIs Relating to URI Template Matching
      4. Accessing Path Information at Runtime
      5. Query Strings and Request Parameters
      6. Matching Precedence
    3. The Portfolio Application
    4. Query Strings vs. Path Parameters vs. WebSocket Messages
    5. Summary of WebSocket Path Mapping APIs
    6. Summary
  15. Chapter 7: Securing WebSocket Server Endpoints
    1. Security Concepts
    2. Java WebSocket API Security
      1. Authentication
      2. Authorization
      3. Private Communication
      4. Java WebSocket Security APIs
    3. Stock Account Application
    4. Summary
  16. Chapter 8: WebSockets in the Java EE Platform
    1. The Role of Java WebSockets in the Java EE Platform
    2. Sharing Web Application State
      1. HttpSession to WebSocket Session Association
      2. The HttpSession Sample
    3. Using EJBs from WebSocket Endpoints
      1. The EJB Example
    4. The Chat Redux Example
    5. Summary
  17. Index

Product information

  • Title: Java WebSocket Programming
  • Author(s): Dr. Danny Coward
  • Release date: October 2013
  • Publisher(s): McGraw Hill Computing
  • ISBN: 9780071827188