SlideShare una empresa de Scribd logo
1 de 41
Descargar para leer sin conexión
Reverse-Ajax

    Par Mathieu Carbou, le 17 avril 2011




       Samples à https://github.com/Ovea/conf-reverse-ajax


Site: http://lab.ovea.com/
Blog: http://blog.mycila.com
Mail: mathieu.carbou@gmail.com
Reverse Ajax refers to an Ajax design
   pattern   that   uses    long-lived   HTTP
   connections     to    enable   low-latency
   communication between a web server and a
   browser. Basically it is a way of sending
   data from client to server and a mechanism
   for pushing server data back to the
   browser.




Site: http://lab.ovea.com/
Blog: http://blog.mycila.com
Mail: mathieu.carbou@gmail.com
Event-Driven Web Applications




Site: http://lab.ovea.com/
Blog: http://blog.mycila.com
Mail: mathieu.carbou@gmail.com
Reverse-Ajax techniques


        1.     Polling
        2.     Piggyback
        3.     Comet
        4.     WebSockets



Site: http://lab.ovea.com/
Blog: http://blog.mycila.com
Mail: mathieu.carbou@gmail.com
1. Polling


    I.e. Check for messages each 4 seconds




Site: http://lab.ovea.com/
Blog: http://blog.mycila.com
Mail: mathieu.carbou@gmail.com
1. Polling



                                 DEMO




Site: http://lab.ovea.com/
Blog: http://blog.mycila.com
Mail: mathieu.carbou@gmail.com
2. Piggyback


    Check for messages when an action is
    performed.




Site: http://lab.ovea.com/
Blog: http://blog.mycila.com
Mail: mathieu.carbou@gmail.com
2. Piggyback



                                 DEMO




Site: http://lab.ovea.com/
Blog: http://blog.mycila.com
Mail: mathieu.carbou@gmail.com
3. Comet


    A long-held HTTP request allows a web
    server to push data to a browser, without
    the browser explicitly requesting it.




Site: http://lab.ovea.com/
Blog: http://blog.mycila.com
Mail: mathieu.carbou@gmail.com
3. Comet techniques

        1.Long polling
          ● XMLHttpRequest
          ● Script tag

        2.Stream based
          ● Forever Iframe
          ● XMLHttpRequest Multipart
Site: http://lab.ovea.com/
Blog: http://blog.mycila.com
Mail: mathieu.carbou@gmail.com
3. Comet



                                 DEMO

            XMLHttpRequest Long Polling
             (with Jetty Coninuations)

Site: http://lab.ovea.com/
Blog: http://blog.mycila.com
Mail: mathieu.carbou@gmail.com
3. Comet



                                 DEMO

          XMLHttpRequest Multipart
         (with Jetty Coninuations)

Site: http://lab.ovea.com/
Blog: http://blog.mycila.com
Mail: mathieu.carbou@gmail.com
3. Comet



                                 DEMO

            XMLHttpRequest Multipart
             (with Servlet 3.0 API)

Site: http://lab.ovea.com/
Blog: http://blog.mycila.com
Mail: mathieu.carbou@gmail.com
4. WebSockets


    WebSocket & FlashSockets

    WebSocket is a technology providing for
    bi-directional, full-duplex
    communications channels. It is designed
    to be implemented in web browsers and web
    servers but it can be used by any client
    or server application .

Site: http://lab.ovea.com/
Blog: http://blog.mycila.com
Mail: mathieu.carbou@gmail.com
4. WebSockets



                                 DEMO




Site: http://lab.ovea.com/
Blog: http://blog.mycila.com
Mail: mathieu.carbou@gmail.com
Reverse-Ajax for Java

    ●   Cannot use standard Servlets
    ●   Cannot use blocking I/O
    ●   Cannot retain request thread

        => Needs NIO + Features



Site: http://lab.ovea.com/
Blog: http://blog.mycila.com
Mail: mathieu.carbou@gmail.com
Reverse-Ajax for Java

        You need 3 things:

    1. A good server (NIO)

    2. A good client library

    3. A good backend library
Site: http://lab.ovea.com/
Blog: http://blog.mycila.com
Mail: mathieu.carbou@gmail.com
Servers


     ●   Jetty 8 (WebSocket, Comet)
     ●   Grizzly (WebSocket, Comet)
     ●   Tomcat 7 (Comet)

     ●   All Servlet 3.0 based


Site: http://lab.ovea.com/
Blog: http://blog.mycila.com
Mail: mathieu.carbou@gmail.com
Servers

     ● For WebSocket: only native, per
     container (i.e. WebSocketServlet)

     ● For Comet: Servlet 3.0
     containers, Jetty Continuations

     ●   Polling, Piggyback anywhere

Site: http://lab.ovea.com/
Blog: http://blog.mycila.com
Mail: mathieu.carbou@gmail.com
Libraries


        1.     Socket.IO
        2.     Atmosphere
        3.     Cometd Bayeux
        4.     [...]



Site: http://lab.ovea.com/
Blog: http://blog.mycila.com
Mail: mathieu.carbou@gmail.com
1. Socket.IO (transports)


        ●   WebSocket
        ●   Adobe Flash Socket
        ●   Comet Long Polling
        ●   Comet Multipart Streaming
        ●   Comet Forever Iframe
        ●   JSONP Polling

Site: http://lab.ovea.com/
Blog: http://blog.mycila.com
Mail: mathieu.carbou@gmail.com
1. Socket.IO (client)

    ● Very good API
    ● Desktop & Mobile & Client-Server

    ● Fallback, reconnect, offline

    messages, event-driven, …

    ●   Event-Driven bridge (Ovea)

Site: http://lab.ovea.com/
Blog: http://blog.mycila.com
Mail: mathieu.carbou@gmail.com
1. Socket.IO (client)

        ●   Internet Explorer 5.5 – 8
        ●   Safari 3 - 5
        ●   Google Chrome 4 - 6
        ●   Firefox 3-4
        ●   Opera 10.61
        ●   iPhone Safari
        ●   iPad Safari
        ●   Android WebKit
        ●   WebOs WebKit
Site: http://lab.ovea.com/
Blog: http://blog.mycila.com
Mail: mathieu.carbou@gmail.com
1. Socket.IO-Java


    ●   Jetty Continuations (portable in
    any container)
    ● Native Jetty Websockets

    ● Servlet 3.0 support




Site: http://lab.ovea.com/
Blog: http://blog.mycila.com
Mail: mathieu.carbou@gmail.com
1. Socket.IO



                                 DEMO




Site: http://lab.ovea.com/
Blog: http://blog.mycila.com
Mail: mathieu.carbou@gmail.com
Event-Driven Web



                                 DEMO

            Socket.IO + Ovea EventBus


Site: http://lab.ovea.com/
Blog: http://blog.mycila.com
Mail: mathieu.carbou@gmail.com
2. Atmosphere (transports)

      ●   WebSocket
      ●   Comet (Polling & Streaming)




Site: http://lab.ovea.com/
Blog: http://blog.mycila.com
Mail: mathieu.carbou@gmail.com
2. Atmosphere (client)

      ●   Currently limited !
      ●   JQuery integration

      ●   BUT integration is possible
           ● With Cometd
           ● Socket.IO (to come ?)

Site: http://lab.ovea.com/
Blog: http://blog.mycila.com
Mail: mathieu.carbou@gmail.com
2. Atmosphere (java)

      ●   Nearly all containers
      ●   Best native support
      ●   Container detection
      ●   WebSocket




Site: http://lab.ovea.com/
Blog: http://blog.mycila.com
Mail: mathieu.carbou@gmail.com
2. Atmosphere



                                 DEMO




Site: http://lab.ovea.com/
Blog: http://blog.mycila.com
Mail: mathieu.carbou@gmail.com
3. Cometd (transports)

      ●   WebSocket
      ●   Comet Long Polling
      ●   JSONP Polling

      ● The most reliable and
      performant

Site: http://lab.ovea.com/
Blog: http://blog.mycila.com
Mail: mathieu.carbou@gmail.com
3. Cometd (client)


    ● Event-based
    ● Jquery / Dojo

    ● Desktop & Mobile & Client-

    Server, Any Browser
    ● Extensions

    ● Very good API




Site: http://lab.ovea.com/
Blog: http://blog.mycila.com
Mail: mathieu.carbou@gmail.com
3. Cometd (java)


    ●   Jetty Continuations (portable in
    any container)
    ● Native Jetty Websockets

    ● Servlet 3.0 support




Site: http://lab.ovea.com/
Blog: http://blog.mycila.com
Mail: mathieu.carbou@gmail.com
3. Cometd



                                 DEMO




Site: http://lab.ovea.com/
Blog: http://blog.mycila.com
Mail: mathieu.carbou@gmail.com
Resources (info)


       ➔   Exploring Reverse AJAX
       ➔   Comet
       ➔   WebSocket
       ➔   Portable Jetty Continuations




Site: http://lab.ovea.com/
Blog: http://blog.mycila.com
Mail: mathieu.carbou@gmail.com
Resources (projects)


       ➔   EventBus
       ➔   Socket.IO
       ➔   Socket.IO (Java)
       ➔   Atmosphere
       ➔   Cometd Bayeux




Site: http://lab.ovea.com/
Blog: http://blog.mycila.com
Mail: mathieu.carbou@gmail.com
Reverse-Ajax

                            QUESTIONS ?




Site: http://lab.ovea.com/
Blog: http://blog.mycila.com
Mail: mathieu.carbou@gmail.com

Más contenido relacionado

La actualidad más candente

La actualidad más candente (20)

Websocket 101 in Python
Websocket 101 in PythonWebsocket 101 in Python
Websocket 101 in Python
 
Comet web applications with Python, Django & Orbited
Comet web applications with Python, Django & OrbitedComet web applications with Python, Django & Orbited
Comet web applications with Python, Django & Orbited
 
Automated Releases to RubyGems.org using Travis-CI.org
Automated Releases to RubyGems.org using Travis-CI.orgAutomated Releases to RubyGems.org using Travis-CI.org
Automated Releases to RubyGems.org using Travis-CI.org
 
Asynchronous Web Programming with HTML5 WebSockets and Java
Asynchronous Web Programming with HTML5 WebSockets and JavaAsynchronous Web Programming with HTML5 WebSockets and Java
Asynchronous Web Programming with HTML5 WebSockets and Java
 
No callbacks, No Threads - Cooperative web servers in Ruby 1.9
No callbacks, No Threads - Cooperative web servers in Ruby 1.9No callbacks, No Threads - Cooperative web servers in Ruby 1.9
No callbacks, No Threads - Cooperative web servers in Ruby 1.9
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 
WebSockets Everywhere: the Future Transport Protocol for Everything (Almost)
WebSockets Everywhere: the Future Transport Protocol for Everything (Almost)WebSockets Everywhere: the Future Transport Protocol for Everything (Almost)
WebSockets Everywhere: the Future Transport Protocol for Everything (Almost)
 
HTTP2 is Here!
HTTP2 is Here!HTTP2 is Here!
HTTP2 is Here!
 
Release with confidence
Release with confidenceRelease with confidence
Release with confidence
 
Using Modern Browser APIs to Improve the Performance of Your Web Applications
Using Modern Browser APIs to Improve the Performance of Your Web ApplicationsUsing Modern Browser APIs to Improve the Performance of Your Web Applications
Using Modern Browser APIs to Improve the Performance of Your Web Applications
 
The MetaCPAN VM for Dummies Part One (Installation)
The MetaCPAN VM for Dummies Part One (Installation)The MetaCPAN VM for Dummies Part One (Installation)
The MetaCPAN VM for Dummies Part One (Installation)
 
Measuring Continuity
Measuring ContinuityMeasuring Continuity
Measuring Continuity
 
Full-Stack Plone Deployment with Ansible
Full-Stack Plone Deployment with AnsibleFull-Stack Plone Deployment with Ansible
Full-Stack Plone Deployment with Ansible
 
webworkers
webworkerswebworkers
webworkers
 
Performance Improvements in Browsers
Performance Improvements in BrowsersPerformance Improvements in Browsers
Performance Improvements in Browsers
 
SDPHP - Percona Toolkit (It's Basically Magic)
SDPHP - Percona Toolkit (It's Basically Magic)SDPHP - Percona Toolkit (It's Basically Magic)
SDPHP - Percona Toolkit (It's Basically Magic)
 
Learnings from govuk
Learnings from govukLearnings from govuk
Learnings from govuk
 
Apache TomEE, Java EE 6 Web Profile {and more} on Tomcat
Apache TomEE, Java EE 6 Web Profile {and more} on TomcatApache TomEE, Java EE 6 Web Profile {and more} on Tomcat
Apache TomEE, Java EE 6 Web Profile {and more} on Tomcat
 
Plone Deployment Secrets & Tricks
Plone Deployment Secrets & TricksPlone Deployment Secrets & Tricks
Plone Deployment Secrets & Tricks
 
Plone Deployment (PloneConf Edition)
Plone Deployment (PloneConf Edition)Plone Deployment (PloneConf Edition)
Plone Deployment (PloneConf Edition)
 

Similar a Reverse Ajax

Websockets at tossug
Websockets at tossugWebsockets at tossug
Websockets at tossug
clkao
 
V2 peter-lubbers-sf-jug-websocket
V2 peter-lubbers-sf-jug-websocketV2 peter-lubbers-sf-jug-websocket
V2 peter-lubbers-sf-jug-websocket
brent bucci
 
Programming WebSockets - April 20 2010
Programming WebSockets - April 20 2010Programming WebSockets - April 20 2010
Programming WebSockets - April 20 2010
sullis
 
Programming WebSockets - OSCON 2010
Programming WebSockets - OSCON 2010Programming WebSockets - OSCON 2010
Programming WebSockets - OSCON 2010
sullis
 
Peter lubbers-html5-offline-web-apps
Peter lubbers-html5-offline-web-appsPeter lubbers-html5-offline-web-apps
Peter lubbers-html5-offline-web-apps
Skills Matter
 

Similar a Reverse Ajax (20)

Redis Introduction
Redis IntroductionRedis Introduction
Redis Introduction
 
Websockets at tossug
Websockets at tossugWebsockets at tossug
Websockets at tossug
 
WebSockets wiith Scala and Play! Framework
WebSockets wiith Scala and Play! FrameworkWebSockets wiith Scala and Play! Framework
WebSockets wiith Scala and Play! Framework
 
Rails 生態圈一覽
Rails 生態圈一覽Rails 生態圈一覽
Rails 生態圈一覽
 
V2 peter-lubbers-sf-jug-websocket
V2 peter-lubbers-sf-jug-websocketV2 peter-lubbers-sf-jug-websocket
V2 peter-lubbers-sf-jug-websocket
 
Programming WebSockets - April 20 2010
Programming WebSockets - April 20 2010Programming WebSockets - April 20 2010
Programming WebSockets - April 20 2010
 
Programming WebSockets - OSCON 2010
Programming WebSockets - OSCON 2010Programming WebSockets - OSCON 2010
Programming WebSockets - OSCON 2010
 
Selenium cloud
Selenium cloudSelenium cloud
Selenium cloud
 
The HTML5 WebSocket API
The HTML5 WebSocket APIThe HTML5 WebSocket API
The HTML5 WebSocket API
 
Web-Socket
Web-SocketWeb-Socket
Web-Socket
 
Peter lubbers-html5-offline-web-apps
Peter lubbers-html5-offline-web-appsPeter lubbers-html5-offline-web-apps
Peter lubbers-html5-offline-web-apps
 
Web Standards Support in WebKit
Web Standards Support in WebKitWeb Standards Support in WebKit
Web Standards Support in WebKit
 
Graph ql subscriptions through the looking glass
Graph ql subscriptions through the looking glassGraph ql subscriptions through the looking glass
Graph ql subscriptions through the looking glass
 
Graph ql subscriptions on the jvm
Graph ql subscriptions on the jvmGraph ql subscriptions on the jvm
Graph ql subscriptions on the jvm
 
ONAP MultiCloud/K8s Casablanca
ONAP MultiCloud/K8s CasablancaONAP MultiCloud/K8s Casablanca
ONAP MultiCloud/K8s Casablanca
 
Nodejs and WebSockets
Nodejs and WebSocketsNodejs and WebSockets
Nodejs and WebSockets
 
Going Headless with Craft CMS 3.3
Going Headless with Craft CMS 3.3Going Headless with Craft CMS 3.3
Going Headless with Craft CMS 3.3
 
HTTP colon slash slash: end of the road? @ CakeFest 2013 in San Francisco
HTTP colon slash slash: end of the road? @ CakeFest 2013 in San FranciscoHTTP colon slash slash: end of the road? @ CakeFest 2013 in San Francisco
HTTP colon slash slash: end of the road? @ CakeFest 2013 in San Francisco
 
Real-Time Web applications with WebSockets
Real-Time Web applications with WebSocketsReal-Time Web applications with WebSockets
Real-Time Web applications with WebSockets
 
WebGL Awesomeness
WebGL AwesomenessWebGL Awesomeness
WebGL Awesomeness
 

Último

Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptxHarnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
FIDO Alliance
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 

Último (20)

Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
 
Simplifying Mobile A11y Presentation.pptx
Simplifying Mobile A11y Presentation.pptxSimplifying Mobile A11y Presentation.pptx
Simplifying Mobile A11y Presentation.pptx
 
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptxHarnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
 
Cyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptx
Cyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptxCyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptx
Cyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptx
 
AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by Anitaraj
 
Vector Search @ sw2con for slideshare.pptx
Vector Search @ sw2con for slideshare.pptxVector Search @ sw2con for slideshare.pptx
Vector Search @ sw2con for slideshare.pptx
 
Design and Development of a Provenance Capture Platform for Data Science
Design and Development of a Provenance Capture Platform for Data ScienceDesign and Development of a Provenance Capture Platform for Data Science
Design and Development of a Provenance Capture Platform for Data Science
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptx
 
How to Check CNIC Information Online with Pakdata cf
How to Check CNIC Information Online with Pakdata cfHow to Check CNIC Information Online with Pakdata cf
How to Check CNIC Information Online with Pakdata cf
 
Introduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMIntroduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDM
 
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
 
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
 
Introduction to FIDO Authentication and Passkeys.pptx
Introduction to FIDO Authentication and Passkeys.pptxIntroduction to FIDO Authentication and Passkeys.pptx
Introduction to FIDO Authentication and Passkeys.pptx
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
AI mind or machine power point presentation
AI mind or machine power point presentationAI mind or machine power point presentation
AI mind or machine power point presentation
 
Microsoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - QuestionnaireMicrosoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - Questionnaire
 
Event-Driven Architecture Masterclass: Challenges in Stream Processing
Event-Driven Architecture Masterclass: Challenges in Stream ProcessingEvent-Driven Architecture Masterclass: Challenges in Stream Processing
Event-Driven Architecture Masterclass: Challenges in Stream Processing
 
ERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage IntacctERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage Intacct
 
Stronger Together: Developing an Organizational Strategy for Accessible Desig...
Stronger Together: Developing an Organizational Strategy for Accessible Desig...Stronger Together: Developing an Organizational Strategy for Accessible Desig...
Stronger Together: Developing an Organizational Strategy for Accessible Desig...
 
Overview of Hyperledger Foundation
Overview of Hyperledger FoundationOverview of Hyperledger Foundation
Overview of Hyperledger Foundation
 

Reverse Ajax

  • 1. Reverse-Ajax Par Mathieu Carbou, le 17 avril 2011 Samples à https://github.com/Ovea/conf-reverse-ajax Site: http://lab.ovea.com/ Blog: http://blog.mycila.com Mail: mathieu.carbou@gmail.com
  • 2. Reverse Ajax refers to an Ajax design pattern that uses long-lived HTTP connections to enable low-latency communication between a web server and a browser. Basically it is a way of sending data from client to server and a mechanism for pushing server data back to the browser. Site: http://lab.ovea.com/ Blog: http://blog.mycila.com Mail: mathieu.carbou@gmail.com
  • 4. Reverse-Ajax techniques 1. Polling 2. Piggyback 3. Comet 4. WebSockets Site: http://lab.ovea.com/ Blog: http://blog.mycila.com Mail: mathieu.carbou@gmail.com
  • 5. 1. Polling I.e. Check for messages each 4 seconds Site: http://lab.ovea.com/ Blog: http://blog.mycila.com Mail: mathieu.carbou@gmail.com
  • 6.
  • 7. 1. Polling DEMO Site: http://lab.ovea.com/ Blog: http://blog.mycila.com Mail: mathieu.carbou@gmail.com
  • 8. 2. Piggyback Check for messages when an action is performed. Site: http://lab.ovea.com/ Blog: http://blog.mycila.com Mail: mathieu.carbou@gmail.com
  • 9.
  • 10. 2. Piggyback DEMO Site: http://lab.ovea.com/ Blog: http://blog.mycila.com Mail: mathieu.carbou@gmail.com
  • 11. 3. Comet A long-held HTTP request allows a web server to push data to a browser, without the browser explicitly requesting it. Site: http://lab.ovea.com/ Blog: http://blog.mycila.com Mail: mathieu.carbou@gmail.com
  • 12.
  • 13. 3. Comet techniques 1.Long polling ● XMLHttpRequest ● Script tag 2.Stream based ● Forever Iframe ● XMLHttpRequest Multipart Site: http://lab.ovea.com/ Blog: http://blog.mycila.com Mail: mathieu.carbou@gmail.com
  • 14. 3. Comet DEMO XMLHttpRequest Long Polling (with Jetty Coninuations) Site: http://lab.ovea.com/ Blog: http://blog.mycila.com Mail: mathieu.carbou@gmail.com
  • 15. 3. Comet DEMO XMLHttpRequest Multipart (with Jetty Coninuations) Site: http://lab.ovea.com/ Blog: http://blog.mycila.com Mail: mathieu.carbou@gmail.com
  • 16. 3. Comet DEMO XMLHttpRequest Multipart (with Servlet 3.0 API) Site: http://lab.ovea.com/ Blog: http://blog.mycila.com Mail: mathieu.carbou@gmail.com
  • 17. 4. WebSockets WebSocket & FlashSockets WebSocket is a technology providing for bi-directional, full-duplex communications channels. It is designed to be implemented in web browsers and web servers but it can be used by any client or server application . Site: http://lab.ovea.com/ Blog: http://blog.mycila.com Mail: mathieu.carbou@gmail.com
  • 18.
  • 19. 4. WebSockets DEMO Site: http://lab.ovea.com/ Blog: http://blog.mycila.com Mail: mathieu.carbou@gmail.com
  • 20. Reverse-Ajax for Java ● Cannot use standard Servlets ● Cannot use blocking I/O ● Cannot retain request thread => Needs NIO + Features Site: http://lab.ovea.com/ Blog: http://blog.mycila.com Mail: mathieu.carbou@gmail.com
  • 21. Reverse-Ajax for Java You need 3 things: 1. A good server (NIO) 2. A good client library 3. A good backend library Site: http://lab.ovea.com/ Blog: http://blog.mycila.com Mail: mathieu.carbou@gmail.com
  • 22. Servers ● Jetty 8 (WebSocket, Comet) ● Grizzly (WebSocket, Comet) ● Tomcat 7 (Comet) ● All Servlet 3.0 based Site: http://lab.ovea.com/ Blog: http://blog.mycila.com Mail: mathieu.carbou@gmail.com
  • 23. Servers ● For WebSocket: only native, per container (i.e. WebSocketServlet) ● For Comet: Servlet 3.0 containers, Jetty Continuations ● Polling, Piggyback anywhere Site: http://lab.ovea.com/ Blog: http://blog.mycila.com Mail: mathieu.carbou@gmail.com
  • 24. Libraries 1. Socket.IO 2. Atmosphere 3. Cometd Bayeux 4. [...] Site: http://lab.ovea.com/ Blog: http://blog.mycila.com Mail: mathieu.carbou@gmail.com
  • 25. 1. Socket.IO (transports) ● WebSocket ● Adobe Flash Socket ● Comet Long Polling ● Comet Multipart Streaming ● Comet Forever Iframe ● JSONP Polling Site: http://lab.ovea.com/ Blog: http://blog.mycila.com Mail: mathieu.carbou@gmail.com
  • 26. 1. Socket.IO (client) ● Very good API ● Desktop & Mobile & Client-Server ● Fallback, reconnect, offline messages, event-driven, … ● Event-Driven bridge (Ovea) Site: http://lab.ovea.com/ Blog: http://blog.mycila.com Mail: mathieu.carbou@gmail.com
  • 27. 1. Socket.IO (client) ● Internet Explorer 5.5 – 8 ● Safari 3 - 5 ● Google Chrome 4 - 6 ● Firefox 3-4 ● Opera 10.61 ● iPhone Safari ● iPad Safari ● Android WebKit ● WebOs WebKit Site: http://lab.ovea.com/ Blog: http://blog.mycila.com Mail: mathieu.carbou@gmail.com
  • 28. 1. Socket.IO-Java ● Jetty Continuations (portable in any container) ● Native Jetty Websockets ● Servlet 3.0 support Site: http://lab.ovea.com/ Blog: http://blog.mycila.com Mail: mathieu.carbou@gmail.com
  • 29. 1. Socket.IO DEMO Site: http://lab.ovea.com/ Blog: http://blog.mycila.com Mail: mathieu.carbou@gmail.com
  • 30. Event-Driven Web DEMO Socket.IO + Ovea EventBus Site: http://lab.ovea.com/ Blog: http://blog.mycila.com Mail: mathieu.carbou@gmail.com
  • 31. 2. Atmosphere (transports) ● WebSocket ● Comet (Polling & Streaming) Site: http://lab.ovea.com/ Blog: http://blog.mycila.com Mail: mathieu.carbou@gmail.com
  • 32. 2. Atmosphere (client) ● Currently limited ! ● JQuery integration ● BUT integration is possible ● With Cometd ● Socket.IO (to come ?) Site: http://lab.ovea.com/ Blog: http://blog.mycila.com Mail: mathieu.carbou@gmail.com
  • 33. 2. Atmosphere (java) ● Nearly all containers ● Best native support ● Container detection ● WebSocket Site: http://lab.ovea.com/ Blog: http://blog.mycila.com Mail: mathieu.carbou@gmail.com
  • 34. 2. Atmosphere DEMO Site: http://lab.ovea.com/ Blog: http://blog.mycila.com Mail: mathieu.carbou@gmail.com
  • 35. 3. Cometd (transports) ● WebSocket ● Comet Long Polling ● JSONP Polling ● The most reliable and performant Site: http://lab.ovea.com/ Blog: http://blog.mycila.com Mail: mathieu.carbou@gmail.com
  • 36. 3. Cometd (client) ● Event-based ● Jquery / Dojo ● Desktop & Mobile & Client- Server, Any Browser ● Extensions ● Very good API Site: http://lab.ovea.com/ Blog: http://blog.mycila.com Mail: mathieu.carbou@gmail.com
  • 37. 3. Cometd (java) ● Jetty Continuations (portable in any container) ● Native Jetty Websockets ● Servlet 3.0 support Site: http://lab.ovea.com/ Blog: http://blog.mycila.com Mail: mathieu.carbou@gmail.com
  • 38. 3. Cometd DEMO Site: http://lab.ovea.com/ Blog: http://blog.mycila.com Mail: mathieu.carbou@gmail.com
  • 39. Resources (info) ➔ Exploring Reverse AJAX ➔ Comet ➔ WebSocket ➔ Portable Jetty Continuations Site: http://lab.ovea.com/ Blog: http://blog.mycila.com Mail: mathieu.carbou@gmail.com
  • 40. Resources (projects) ➔ EventBus ➔ Socket.IO ➔ Socket.IO (Java) ➔ Atmosphere ➔ Cometd Bayeux Site: http://lab.ovea.com/ Blog: http://blog.mycila.com Mail: mathieu.carbou@gmail.com
  • 41. Reverse-Ajax QUESTIONS ? Site: http://lab.ovea.com/ Blog: http://blog.mycila.com Mail: mathieu.carbou@gmail.com