COMET, l'autre direction du web · Motivation COMET Implémentations COMET, l'autre direction du...

24

Transcript of COMET, l'autre direction du web · Motivation COMET Implémentations COMET, l'autre direction du...

Page 1: COMET, l'autre direction du web · Motivation COMET Implémentations COMET, l'autre direction du web Viktor Horvath, Alixen viktor@fsfe.org OSDC 2010 Viktor Horvath, OSDC 2010 COMET,

MotivationCOMET

Implémentations

COMET, l'autre direction du web

Viktor Horvath, [email protected]

OSDC 2010

Viktor Horvath, OSDC 2010 COMET, l'autre direction du web 1/12

Page 2: COMET, l'autre direction du web · Motivation COMET Implémentations COMET, l'autre direction du web Viktor Horvath, Alixen viktor@fsfe.org OSDC 2010 Viktor Horvath, OSDC 2010 COMET,

MotivationCOMET

Implémentations

Plan

1 Motivation

2 COMET

3 Implémentations

4 Démonstration

Viktor Horvath, OSDC 2010 COMET, l'autre direction du web 2/12

Page 3: COMET, l'autre direction du web · Motivation COMET Implémentations COMET, l'autre direction du web Viktor Horvath, Alixen viktor@fsfe.org OSDC 2010 Viktor Horvath, OSDC 2010 COMET,

MotivationCOMET

Implémentations

Applications conventionnelles

Viktor Horvath, OSDC 2010 COMET, l'autre direction du web 3/12

Page 4: COMET, l'autre direction du web · Motivation COMET Implémentations COMET, l'autre direction du web Viktor Horvath, Alixen viktor@fsfe.org OSDC 2010 Viktor Horvath, OSDC 2010 COMET,

MotivationCOMET

Implémentations

Applications web

Viktor Horvath, OSDC 2010 COMET, l'autre direction du web 4/12

Page 5: COMET, l'autre direction du web · Motivation COMET Implémentations COMET, l'autre direction du web Viktor Horvath, Alixen viktor@fsfe.org OSDC 2010 Viktor Horvath, OSDC 2010 COMET,

MotivationCOMET

Implémentations

Motivation pour le design pattern COMET

1 On veut que le serveur puisse initier la communication. . .

2 de manière e�cace. . .

3 avec les navigateurs d'aujourd'hui.

Établissement des connexions permanentes,utilisable à tout moment par le serveur

Viktor Horvath, OSDC 2010 COMET, l'autre direction du web 5/12

Page 6: COMET, l'autre direction du web · Motivation COMET Implémentations COMET, l'autre direction du web Viktor Horvath, Alixen viktor@fsfe.org OSDC 2010 Viktor Horvath, OSDC 2010 COMET,

MotivationCOMET

Implémentations

Motivation pour le design pattern COMET

1 On veut que le serveur puisse initier la communication. . .

2 de manière e�cace. . .

3 avec les navigateurs d'aujourd'hui.

Établissement des connexions permanentes,utilisable à tout moment par le serveur

Viktor Horvath, OSDC 2010 COMET, l'autre direction du web 5/12

Page 7: COMET, l'autre direction du web · Motivation COMET Implémentations COMET, l'autre direction du web Viktor Horvath, Alixen viktor@fsfe.org OSDC 2010 Viktor Horvath, OSDC 2010 COMET,

MotivationCOMET

Implémentations

Motivation pour le design pattern COMET

1 On veut que le serveur puisse initier la communication. . .

2 de manière e�cace. . .

3 avec les navigateurs d'aujourd'hui.

Établissement des connexions permanentes,utilisable à tout moment par le serveur

Viktor Horvath, OSDC 2010 COMET, l'autre direction du web 5/12

Page 8: COMET, l'autre direction du web · Motivation COMET Implémentations COMET, l'autre direction du web Viktor Horvath, Alixen viktor@fsfe.org OSDC 2010 Viktor Horvath, OSDC 2010 COMET,

MotivationCOMET

Implémentations

Motivation pour le design pattern COMET

1 On veut que le serveur puisse initier la communication. . .

2 de manière e�cace. . .

3 avec les navigateurs d'aujourd'hui.

Établissement des connexions permanentes,utilisable à tout moment par le serveur

Viktor Horvath, OSDC 2010 COMET, l'autre direction du web 5/12

Page 9: COMET, l'autre direction du web · Motivation COMET Implémentations COMET, l'autre direction du web Viktor Horvath, Alixen viktor@fsfe.org OSDC 2010 Viktor Horvath, OSDC 2010 COMET,

MotivationCOMET

Implémentations

Mode � streaming �, connexions persistantes HTTP 1.1

� <iframe> caché (� forever frame �)

� Gecko : réponse XHR multipart

Viktor Horvath, OSDC 2010 COMET, l'autre direction du web 6/12

Page 10: COMET, l'autre direction du web · Motivation COMET Implémentations COMET, l'autre direction du web Viktor Horvath, Alixen viktor@fsfe.org OSDC 2010 Viktor Horvath, OSDC 2010 COMET,

MotivationCOMET

Implémentations

Mode � streaming �, connexions persistantes HTTP 1.1

� <iframe> caché (� forever frame �)

� Gecko : réponse XHR multipart

Viktor Horvath, OSDC 2010 COMET, l'autre direction du web 6/12

Page 11: COMET, l'autre direction du web · Motivation COMET Implémentations COMET, l'autre direction du web Viktor Horvath, Alixen viktor@fsfe.org OSDC 2010 Viktor Horvath, OSDC 2010 COMET,

MotivationCOMET

Implémentations

Mode � streaming �, connexions persistantes HTTP 1.1

� <iframe> caché (� forever frame �)

� Gecko : réponse XHR multipart

Viktor Horvath, OSDC 2010 COMET, l'autre direction du web 6/12

Page 12: COMET, l'autre direction du web · Motivation COMET Implémentations COMET, l'autre direction du web Viktor Horvath, Alixen viktor@fsfe.org OSDC 2010 Viktor Horvath, OSDC 2010 COMET,

MotivationCOMET

Implémentations

Mode � long-polling �

� Requêtes XHR

� Tags <script>

Viktor Horvath, OSDC 2010 COMET, l'autre direction du web 7/12

Page 13: COMET, l'autre direction du web · Motivation COMET Implémentations COMET, l'autre direction du web Viktor Horvath, Alixen viktor@fsfe.org OSDC 2010 Viktor Horvath, OSDC 2010 COMET,

MotivationCOMET

Implémentations

Mode � long-polling �

� Requêtes XHR

� Tags <script>

Viktor Horvath, OSDC 2010 COMET, l'autre direction du web 7/12

Page 14: COMET, l'autre direction du web · Motivation COMET Implémentations COMET, l'autre direction du web Viktor Horvath, Alixen viktor@fsfe.org OSDC 2010 Viktor Horvath, OSDC 2010 COMET,

MotivationCOMET

Implémentations

Mode � long-polling �

� Requêtes XHR

� Tags <script>

Viktor Horvath, OSDC 2010 COMET, l'autre direction du web 7/12

Page 15: COMET, l'autre direction du web · Motivation COMET Implémentations COMET, l'autre direction du web Viktor Horvath, Alixen viktor@fsfe.org OSDC 2010 Viktor Horvath, OSDC 2010 COMET,

MotivationCOMET

Implémentations

Protocoles

� Orienté vers canaux nommés de communication(publish/subscribe) :

� Le protocole Bayeux� Protocoles propres à une solution serveur/client

� Simulation des sockets : BOSH

� Vers les bus de messages : AMQP

Viktor Horvath, OSDC 2010 COMET, l'autre direction du web 8/12

Page 16: COMET, l'autre direction du web · Motivation COMET Implémentations COMET, l'autre direction du web Viktor Horvath, Alixen viktor@fsfe.org OSDC 2010 Viktor Horvath, OSDC 2010 COMET,

MotivationCOMET

Implémentations

Protocoles

� Orienté vers canaux nommés de communication(publish/subscribe) :

� Le protocole Bayeux

� Protocoles propres à une solution serveur/client

� Simulation des sockets : BOSH

� Vers les bus de messages : AMQP

Viktor Horvath, OSDC 2010 COMET, l'autre direction du web 8/12

Page 17: COMET, l'autre direction du web · Motivation COMET Implémentations COMET, l'autre direction du web Viktor Horvath, Alixen viktor@fsfe.org OSDC 2010 Viktor Horvath, OSDC 2010 COMET,

MotivationCOMET

Implémentations

Protocoles

� Orienté vers canaux nommés de communication(publish/subscribe) :

� Le protocole Bayeux� Protocoles propres à une solution serveur/client

� Simulation des sockets : BOSH

� Vers les bus de messages : AMQP

Viktor Horvath, OSDC 2010 COMET, l'autre direction du web 8/12

Page 18: COMET, l'autre direction du web · Motivation COMET Implémentations COMET, l'autre direction du web Viktor Horvath, Alixen viktor@fsfe.org OSDC 2010 Viktor Horvath, OSDC 2010 COMET,

MotivationCOMET

Implémentations

Protocoles

� Orienté vers canaux nommés de communication(publish/subscribe) :

� Le protocole Bayeux� Protocoles propres à une solution serveur/client

� Simulation des sockets : BOSH

� Vers les bus de messages : AMQP

Viktor Horvath, OSDC 2010 COMET, l'autre direction du web 8/12

Page 19: COMET, l'autre direction du web · Motivation COMET Implémentations COMET, l'autre direction du web Viktor Horvath, Alixen viktor@fsfe.org OSDC 2010 Viktor Horvath, OSDC 2010 COMET,

MotivationCOMET

Implémentations

Protocoles

� Orienté vers canaux nommés de communication(publish/subscribe) :

� Le protocole Bayeux� Protocoles propres à une solution serveur/client

� Simulation des sockets : BOSH

� Vers les bus de messages : AMQP

Viktor Horvath, OSDC 2010 COMET, l'autre direction du web 8/12

Page 20: COMET, l'autre direction du web · Motivation COMET Implémentations COMET, l'autre direction du web Viktor Horvath, Alixen viktor@fsfe.org OSDC 2010 Viktor Horvath, OSDC 2010 COMET,

MotivationCOMET

Implémentations

Alternatives

� HTML 5 : WebSockets, server�side events

� Adobe Flash, Silverlight ou autres plug�ins

Viktor Horvath, OSDC 2010 COMET, l'autre direction du web 9/12

Page 21: COMET, l'autre direction du web · Motivation COMET Implémentations COMET, l'autre direction du web Viktor Horvath, Alixen viktor@fsfe.org OSDC 2010 Viktor Horvath, OSDC 2010 COMET,

MotivationCOMET

Implémentations

Alternatives

� HTML 5 : WebSockets, server�side events

� Adobe Flash, Silverlight ou autres plug�ins

Viktor Horvath, OSDC 2010 COMET, l'autre direction du web 9/12

Page 22: COMET, l'autre direction du web · Motivation COMET Implémentations COMET, l'autre direction du web Viktor Horvath, Alixen viktor@fsfe.org OSDC 2010 Viktor Horvath, OSDC 2010 COMET,

MotivationCOMET

Implémentations

Serveurs

Nom Protocole Technique écrit en

Jetty Bayeux LP WS Java

Meteor [propre] LP STR SSE Perl

Orbited Sockets,message bus LP STR SSE WS Python

Ajax Push Engine [propre] LP STR SSE WS C

ErlyComet Bayeux LP WS Erlang

nginx HTTP Push Basic HTTP PushRelay Protocol LP C

em-websocket EventMachine WS Ruby

. . . et encore plus !

LP = long polling, STR = streaming, SSE = Server�Sent Events, WS = WebSockets

Viktor Horvath, OSDC 2010 COMET, l'autre direction du web 10/12

Page 23: COMET, l'autre direction du web · Motivation COMET Implémentations COMET, l'autre direction du web Viktor Horvath, Alixen viktor@fsfe.org OSDC 2010 Viktor Horvath, OSDC 2010 COMET,

MotivationCOMET

Implémentations

Liens

Article Wikipedia . . . . . http://en.wikipedia.org/wiki/Comet_(programming)AJAX Design Patterns : � HTTP Streaming �. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . http://ajaxpatterns.org/HTTP_StreamingTutoriel en BD et serveur/client sur . http://www.ape-project.orgNouvelles sur COMET . . . . . . . . . . . . . . . . . . . http://cometdaily.comComparaison des serveurs . . . . . . . . http://cometdaily.com/maturity.htmlProtocole Bayeux, CometD implementations . . . http://cometd.orgnginx HTTP Push avec client Ruby. . . http://www.igvita.com/2009/10/21/nginx-comet-low-latency-server-pushCOMET en Java (Jetty et Tomcat). . . . http://www.javaworld.com/javaworld/jw-03-2008/jw-03-asynchhttp.htmlHTML 5 : Server�Side Events et WebSockets. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . http://www.java.net/author/gregor-roth

Viktor Horvath, OSDC 2010 COMET, l'autre direction du web 11/12

Page 24: COMET, l'autre direction du web · Motivation COMET Implémentations COMET, l'autre direction du web Viktor Horvath, Alixen viktor@fsfe.org OSDC 2010 Viktor Horvath, OSDC 2010 COMET,

MotivationCOMET

Implémentations

Démonstration

http://comet.steckenpferde.de:8080

http://comet.steckenpferde.de

Chat démo, à regarder avec l'analyse du tra�c réseau :

� Firefox + Firebug : version Dojo

� Chromium + Web Developer Tools : version jQuery

Viktor Horvath, OSDC 2010 COMET, l'autre direction du web 12/12