Blog

Understanding long polling, comet, websokets and sse

In the examples below the client is the browser and the server is the webserver hosting the website.

Before you can understand these technologies, you have to understand classic http web traffic first.

Regular http:

  1. A client requests a webpage from a server.
  2. The server calculates the response
  3. The server sends the response to the client.

HTTP

AJAX Polling:

  1. A client requests a webpage from a server using regular http (see http above).
  2. The requested webpage executes javascript which requests a file from the server at regular intervals (e.g. 0.5 seconds).
  3. The server calculates each response and sends it back, just like normal http traffic.

AJAX Polling

AJAX Long-Polling:

  1. A client requests a webpage from a server using regular http (see http above).
  2. The requested webpage executes javascript which requests a file from the server.
  3. The server does not immediately respond with the requested information but waits until there's new information available.
  4. When there's new information available, the server responds with the new information.
  5. The client receives the new information and immediately sends another request to the server, re-starting the process.

AJAX Long-Polling

download exaple here:- https://github.com/panique/php-long-polling

 

HTML5 Server Sent Events (SSE) / EventSource:

  1. A client requests a webpage from a server using regular http (see http above).
  2. The requested webpage executes javascript which opens a connection to the server.
  3. The server sends an event to the client when there's new information available.

    • Real-time traffic from server to client, mostly that's what you'll need
    • You'll want to use a server that has an event loop
    • Not possible to connect with a server from another domain
    • If you want to read more, I found these very useful: (article), (article), (article), (tutorial).

HTML5 SSE

HTML5 Websockets:

  1. A client requests a webpage from a server using regular http (see http above).
  2. The requested webpage executes javascript which opens a connection with the server.
  3. The server and the client can now send each other messages when new data (on either side) is available.

    • Real-time traffic from the server to the client and from the client to the server
    • You'll want to use a server that has an event loop
    • With WebSockets it is possible to connect with a server from another domain.
    • It is also possible to use a third party hosted websocket server, for example Pusher or others. This way you'll only have to implement the client side, which is very easy!
    • If you want to read more, I found these very useful: (article), (article) (tutorial).

HTML5 WebSockets

Comet:

Comet is a collection of techniques prior to HTML5 which use streaming and long-polling to achieve real time applications. Read more on wikipedia or this article.

.

Comments 30

  • iodishodactMar 28, 2018 Reply

    http://rotanaroom.com/ - - http://20294445.com/images/1/3058.jpg http://bearshirtpress.com/video/acab27eb2f.html?cat=interracial - black gang bang a checkic http://fitnesgid.info/ - - http://azzoul.net/images/1/1845.jpg http://fithealth101.biz/xxx.php?tube=/videos/daughter-entirely-hatefucked-2/ - Daughter entirely hatefucked http://31733677.com/ - - http://secrets-of-da-vinci.com/images/1/1019.jpg http://kingbetting115.com/categories/hardcore - Hardcore http://09288622.com/ - - http://enous.info/images/1/2230.jpg http://lc-20.com/ - - http://transformyourrelationshipsnow.com/images/1/3228.jpg http://hediimd.com/watch-two-libidinous-chicks-measuring-little-cock-with-a-ruler.html - 60% 5:00

  • iodishodactMar 28, 2018 Reply

    http://nchzx.com/ - - http://339174.com/images/1/1369.jpg http://31755799.com/pdv/PY3LCoMwEEW_xizFqBG7yCKg3Sl02VVI65QIjkmTaKRf37SUwuU-Bobz4FVbFDWtC_LkJaXE84YRyxlZuA7B-qwSWXlOOrRCH8Dld4Npotln8KnQpj3VZZOaQhVgczLF5kBa5f1s1nST2iCgmkB6OGRQFnIdcCGaU8bI9gX9OTHG3Bq3Tmqfpx9st8mG14WOt2scOnGMXS_E54EAp28 - Mature Passionate Sex Tape 10:42 3 months ago 135397 http://parspay2.biz/ - - http://becarine.com/images/1/2483.jpg http://snehaap.org/video/83cab75edb.html?cat=romantic - desi bhabhi romance and fuck with lover http://31722977.com/ - - http://arsenehodali.com/images/1/1789.jpg http://sidneycrosbydaily.com/pdv/S7M1MbMwMjY0N1UrtDW1MFArtjVVK7A1NlDLsc0oKSkoVjV2VDVyA6LEvMqC_KI8veT8XCDPxNDYzNIcyFDLsDU0NVUrBauGKy4vL9cDqU5JLMtMgWopKwASvlWBhn4h7lW-Lp5Gfi7Jbo4gDWqptoYA - Belle Claire makes her feel amazing cause she loves cocks - Belle Claire 6:00 1 week ago 2370 http://mynicemall.com/ - - http://meetwestbradford.com/images/1/2468.jpg http://freeen.info/ - - http://openslickdesign.com/images/1/2455.jpg http://strong-exp.biz/categories/lesbian-bondage - Bondage Lesbienne

  • iodishodactMar 28, 2018 Reply

    http://09299811.com/ - - http://enous.info/images/1/2177.jpg http://daphacp.com/pt/teacher-best/1.html - professor http://zzhsg.com/ - - http://31755577.com/images/1/738.jpg http://etheretanks.com/?duration=medium&filter=date - Newest Videos http://ezoom360.com/ - - http://wearethepower.com/images/1/2476.jpg http://zflsjl.com/pdv/VY1BDoMgFERPIzuMXyShCxamtjubeASKNJgqUECJPX2x6abJZGYy-T_vwRtWVZSdavTiQCgKnFXIcUbQzHWMLhSkLeprVkqp3O3qrDeltMuxiCh1TmgIg5qRXGswIq5ezAFLrbzf8XMKAY9KOSyMmLG3izBS5VOkOVCK1i_mj3IgRrFN44-zuWz9e4Db_ZL67gyhG87t8YAUhw8 - 21Naturals Cherry Kiss Deep Anal Romance 7:30 21 hours ago NEW http://momsbabydiapers.com/ - - http://cslrwx.com/images/1/100.jpg http://lowercases.com/ - - http://31755166.com/images/1/2039.jpg http://fortcollinsseo.net/pdv/NY3BCoMwDIafxtyU1WLxkoMwdttghz2A1o52q6az1YJPv8gYhD8Jf_58T2xbJZRo4INKnSRErBUEVC14LOoLlzXeB1pmqjRNvG9uNBR5mPoY3WbKwff6XWpicXNkt7RmObLyEhaayI2FPKd1MPoFFkXTwIo2pVDI7kfIOVcHYez5958SWK77XaShy9z3W_c4zsGg-AI - Massive inside her 10:00 3 years ago 28939

  • iodishodactMar 28, 2018 Reply

    http://preverseclosings.com/ - - http://karosseriebau-krausse.com/images/1/1134.jpg http://theflashupdate.com/video/4f61c78d06.html?cat=celebrity - january jones mad men compilation http://escomenergy.com/ - - http://goodsforbuy.com/images/1/1212.jpg http://satoshifunds.com/new/?d=short&period=all - Short (1-3 min) http://31755799.com/ - - http://31755233.com/images/1/967.jpg http://fbzdyo.info/search/Dorm/ - Dorm [86 - http://09288511.com/ - - http://majestic-eyeelixir.com/images/1/1544.jpg http://freeen.info/ - - http://invoite.info/images/1/160.jpg http://shseae.com/pornstar/alina-li - Alina Li

  • iodishodactMar 29, 2018 Reply

    http://sjyjd.com/ - - http://lc-20.com/images/1/2725.jpg http://jyfootballl.com/n/bisexual/ - Bisexual4019 http://20204445.com/ - - http://sinektv.com/images/1/1153.jpg http://marineservicesnaples.com/video34486733/porn-nl/0/angel_uit_zwolle - Angel uit Zwolle http://wwwptanow.info/ - - http://31722855.com/images/1/2494.jpg http://valleyridge.biz/videos/14213/hot-natural-russian-beauty-kira-queen-rides-black-cock/ - Hot natural Russian beauty Kira Queen rides black cock http://transformyourrelationshipsnow.com/ - - http://courne.com/images/1/989.jpg http://wordhouseauto.com/ - - http://thaicora.com/images/1/2724.jpg http://933b.com/pornstars/sherri-d/ - Sherri D

  • iodishodactMar 29, 2018 Reply

    http://09288511.com/ - - http://31733111.com/images/1/8.jpg http://trendingsuits.com/video/86638319a2.html?cat=mom - slutty mom http://ressamindan.com/ - - http://leeyouthlacrosse.com/images/1/1868.jpg http://axiongard.com/videos/group/ - Videos (5381) http://becarine.com/ - - http://dongview.com/images/1/3005.jpg http://933b.com/pornstars/jill-kassidy/ - Jill Kassidy http://onetouchtransition.com/ - - http://dailydealscenter.com/images/1/2337.jpg http://caffe-diversso.com/ - - http://beauty-thailand.com/images/1/2248.jpg http://438101.com/video/e09bc9cbc7.html?cat=big_cock - vanessa cruz is getting pounded with a big cock

  • iodishodactMar 29, 2018 Reply

    http://majestic-eyeelixir.com/ - - http://zzhsg.com/images/1/1036.jpg http://vaels.com/video/c7b428df28.html?cat=big_tits - Unfaithful english mature lady sonia exposes her gigantic bo http://alcominibottles.com/ - - http://meetlehigh.com/images/1/415.jpg http://downloatanku.com/video/fb73c1231a.html?cat=interracial - curvy valentina nappi gets blacked in front of her blind daddy http://goodsforbuy.com/ - - http://witkamsounds.info/images/1/2432.jpg http://bantradao.com/tags/teen-threesome - Teen Threesome http://satoshifunds.com/ - - http://kalebet105.com/images/1/3432.jpg http://198447.com/ - - http://jhjct.com/images/1/2585.jpg http://spbtcdev.com/main/magazine/default/?volume=1 - Volume 1

  • AnthonyhoaspMar 29, 2018 Reply

    kuhni-lube.ru ????????? ??????

  • DavidezsTesMar 29, 2018 Reply

    ????????? ???? ????????? ?? ?????? ? ??????, ??????? ???????? ??????? ? ?????????? ??????. ???????? ???? ?????? ?????/???????????? ???? ? ???????????? http://staryeprostitutkivomske.ru/mashenka-7 http://molodye-prostitutki-chelyabinska-sex.ru/inessa-4 http://russkieprostitutkipermi.ru ????????? ?????? ??????? ?????? ? ??????? ??????????? ?????? ??????????? ??????? ?????? ? ?????????? ????????? ?????? ????????? ??????? ?????? ? ??????? ??????????? ?????? ????????? ???????????? ? ????????? ?? ????? ???????? ????????? ??????????? ? ????????? ?????????? ????????? ??????????? ??????? ?????? ? ????????? ?????????? u6c52v!hUuS

  • EgorkafuhMar 29, 2018 Reply

    ??????? ??? ?????????? ???? ?????? ?? ????? ????? ?? ??? ?????? ??????????? ?????????? ???????? ????? ??????? ? ????????????? ???????????? ????? ????? ???????: ????? ?????? ??????? ????????? ?????, ??? ???????? ??????????????? ? ??????? ??? ? ??? ????????? ??????? ?? ?????????, ? ????????? ???? ????? ?????????? ?????? ????????, ??? ??????? ????? ???? ?? ??? ??????? ?????? ? ??? ? ??????? ????? ???? ???? ????? ????????????? ????? ?????? ? ???? ?????? ???????? ??????? ?????? ??? ???? ? ?????????? ?????????? ?????????? ?? ?????? ???????? ???????????, ??? ??????? ????????? ?????????? ???????, ??? ????? ? ???????, ??????????? ?????? ????? ?????, ????????? ????? ???????????????? ???? ?????? ?????? ? ????? ???????????????? ??????????????????????? — ???????? ? ????? ??????? seo ??????????? ????? ??? ??????????? ????????? ??? ??????????? ??? ??????? ???????? ???? ?? ?????? ??????? ?/??? Google Analytics ????? ?? ??????? ???????????????????? ? ??????????? ??????;?? ??????? ??????????????? ????????? ?????????, ?? ????? ?????? ????????? ? ?????? ???????? ????????? ??????????? ????????????? ??????????? ?? ?????? ??????? ???? Joomla, ??????????? ?????????? «???????? ??????»? ?????? ?????????? SEO-?????? ?? ?? ????? ?????????????? ??? ??????, ????????? ? ??????????? ????? seo ??????????? ???

Add Comment