codecamp iasi 10 march 2012 - websockets-with-atmosphere

16
Friday, March 9, 12

Upload: codecampiasi

Post on 17-May-2015

758 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: CodeCamp Iasi 10 march 2012 - websockets-with-atmosphere

Friday, March 9, 12

Page 2: CodeCamp Iasi 10 march 2012 - websockets-with-atmosphere

WebSockets with AtmosphereDan Vulpe@dvulpe

10 mar 2012

Friday, March 9, 12

Page 3: CodeCamp Iasi 10 march 2012 - websockets-with-atmosphere

HTTP - Half Duplex

Client Server

Request

Friday, March 9, 12

Page 4: CodeCamp Iasi 10 march 2012 - websockets-with-atmosphere

HTTP - Half Duplex

Client Server

Request

Response

Request

ResponseConnection 2

30-150ms

Friday, March 9, 12

Page 5: CodeCamp Iasi 10 march 2012 - websockets-with-atmosphere

HTTP - Half Duplex

Client Server

Request

Response

Request

ResponseConnection 2

30-150ms

HttpSession

Friday, March 9, 12

Page 6: CodeCamp Iasi 10 march 2012 - websockets-with-atmosphere

WebSocket Full Duplex

Client Server

Single TCP connection

Friday, March 9, 12

Page 7: CodeCamp Iasi 10 march 2012 - websockets-with-atmosphere

WebSocket Full Duplex

Client Server

Handshake Request

WebSocket upgrade

Single TCP connection

Friday, March 9, 12

Page 8: CodeCamp Iasi 10 march 2012 - websockets-with-atmosphere

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

Page 9: CodeCamp Iasi 10 march 2012 - websockets-with-atmosphere

Components

Http RequestMeteorServlet

AtmosphereResource Broadcaster

Friday, March 9, 12

Page 10: CodeCamp Iasi 10 march 2012 - websockets-with-atmosphere

Server: Incoming

• Implement SubProtocol

• handle onMessage events

Friday, March 9, 12

Page 11: CodeCamp Iasi 10 march 2012 - websockets-with-atmosphere

Server: Outgoing

• Request a Broadcaster from Factory

• Subscribe resources to Broadcaster

• Publish messages through Broadcaster

Friday, March 9, 12

Page 12: CodeCamp Iasi 10 march 2012 - websockets-with-atmosphere

JS Client API

Friday, March 9, 12

Page 13: CodeCamp Iasi 10 march 2012 - websockets-with-atmosphere

DEMO

Friday, March 9, 12

Page 14: CodeCamp Iasi 10 march 2012 - websockets-with-atmosphere

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

Page 15: CodeCamp Iasi 10 march 2012 - websockets-with-atmosphere

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

Page 16: CodeCamp Iasi 10 march 2012 - websockets-with-atmosphere

Thank you!Please fill out the evaluation form!

Friday, March 9, 12