SlideShare a Scribd company logo
Friday, March 9, 12
WebSockets with
                 Atmosphere
                 Dan Vulpe
                 @dvulpe

                 10 mar 2012
Friday, March 9, 12
HTTP - Half Duplex
                      Request




                            Client   Server



Friday, March 9, 12
HTTP - Half Duplex
                      Request
                                      30-150ms
                                                      Response
                      Request
                                     Connection 2
                                                      Response


                            Client               Server



Friday, March 9, 12
HTTP - Half Duplex
                      Request
                                      30-150ms
                                                      Response
                                                      HttpSession
                      Request
                                     Connection 2
                                                      Response


                            Client               Server



Friday, March 9, 12
WebSocket Full Duplex

                                         Single TCP connection




                       Client   Server

Friday, March 9, 12
WebSocket Full Duplex
                            Handshake Request


                            WebSocket upgrade



                                                    Single TCP connection




                       Client              Server

Friday, March 9, 12
Atmosphere
                      • Java Framework provides uniform Comet
                        API
                      • Supports: WebLogic, Tomcat, Jetty, Glassfish,
                        JBoss, Grizzly, Servlet 3.0 Async
                      • Fallback to blocking-IO (one thread per
                        channel)
                      • jQuery plugin
                      • WebSocket façade
Friday, March 9, 12
Components
                         MeteorServlet     Http Request




                      AtmosphereResource      Broadcaster




Friday, March 9, 12
Server: Incoming

                      •   Implement
                          SubProtocol

                      •   handle onMessage
                          events




Friday, March 9, 12
Server: Outgoing
                      •   Request a Broadcaster from Factory

                      •   Subscribe resources to Broadcaster

                      •   Publish messages through Broadcaster




Friday, March 9, 12
JS Client API




Friday, March 9, 12
DEMO



Friday, March 9, 12
Java Support
                      •   Server side

                          •   JSR356 - Java API for WebSocket - In Progress

                          •   Containers: Jetty(7, 8), Grizzly/Glassfish, Resin

                      •   Client

                          •   async-http-client




Friday, March 9, 12
Resources

                      •   https://github.com/Atmosphere/atmosphere

                      •   http://www.websocket.org/

                      •   http://www.w3.org/TR/websockets/

                      •   http://wiki.eclipse.org/Jetty/Feature/WebSockets




Friday, March 9, 12
Thank you!
                      Please fill out the evaluation form!




Friday, March 9, 12

More Related Content

CodeCamp Iasi 10 march 2012 - websockets-with-atmosphere

  • 2. WebSockets with Atmosphere Dan Vulpe @dvulpe 10 mar 2012 Friday, March 9, 12
  • 3. HTTP - Half Duplex Request Client Server Friday, March 9, 12
  • 4. HTTP - Half Duplex Request 30-150ms Response Request Connection 2 Response Client Server Friday, March 9, 12
  • 5. HTTP - Half Duplex Request 30-150ms Response HttpSession Request Connection 2 Response Client Server Friday, March 9, 12
  • 6. WebSocket Full Duplex Single TCP connection Client Server Friday, March 9, 12
  • 7. WebSocket Full Duplex Handshake Request WebSocket upgrade Single TCP connection Client Server Friday, March 9, 12
  • 8. Atmosphere • Java Framework provides uniform Comet API • Supports: WebLogic, Tomcat, Jetty, Glassfish, JBoss, Grizzly, Servlet 3.0 Async • Fallback to blocking-IO (one thread per channel) • jQuery plugin • WebSocket façade Friday, March 9, 12
  • 9. Components MeteorServlet Http Request AtmosphereResource Broadcaster Friday, March 9, 12
  • 10. Server: Incoming • Implement SubProtocol • handle onMessage events Friday, March 9, 12
  • 11. Server: Outgoing • Request a Broadcaster from Factory • Subscribe resources to Broadcaster • Publish messages through Broadcaster Friday, March 9, 12
  • 12. JS Client API Friday, March 9, 12
  • 14. Java Support • Server side • JSR356 - Java API for WebSocket - In Progress • Containers: Jetty(7, 8), Grizzly/Glassfish, Resin • Client • async-http-client Friday, March 9, 12
  • 15. Resources • https://github.com/Atmosphere/atmosphere • http://www.websocket.org/ • http://www.w3.org/TR/websockets/ • http://wiki.eclipse.org/Jetty/Feature/WebSockets Friday, March 9, 12
  • 16. Thank you! Please fill out the evaluation form! Friday, March 9, 12