JEE 7: WebSockets

Vít Koma

MOTIVATION

  • Server push
  • Full-duplex 

Solutions

  • Comet
    • streaming
    • polling
    • long polling
  • Java applets
  • WebSockets

WebSockets

  • Full-duplex communication
  • API + protocol
  • Part of HTML5
  • Implemented in browsers and web servers

Communication


WebSockets in Java

  • JSR 356 (part of JEE 7)
  • Uses annotations 
    • Endpoint is POJO (@ServerEndpoint) 
    • Annotated methods handle events 
      • @OnOpen, 
      • @OnClose, 
      • @OnMessage
      • etc.

Other Features

  • State management (session)
  • Path parameters
  • Programmatic Endpoints
  • Encoders and Decoders
  • Full CDI support
  • HttpSession access
  • Standard webapp security

Resources

Q&A

JEE 7: WebSockets

By Vit Koma

JEE 7: WebSockets

  • 324