Real Time Event Dispatcher
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

Real Time Event Dispatcher

on

  • 5,788 views

Pushing symfony events in real time to your clients...

Pushing symfony events in real time to your clients
This talk, held at the symfony live Paris unconference, gives an overview about how events thrown in symfony can be dispatched in real time to web clients. It describes the architecture of the solution and provides examples using the open source comet server APE

Statistics

Views

Total Views
5,788
Views on SlideShare
5,438
Embed Views
350

Actions

Likes
14
Downloads
78
Comments
0

10 Embeds 350

http://www.symfony.es 305
http://turted.xosofox.de 20
http://www.sfexception.com 15
http://translate.googleusercontent.com 2
http://static.slidesharecdn.com 2
http://symfony.es 2
http://paper.li 1
http://webcache.googleusercontent.com 1
http://www.softwarelibre.net 1
http://symfony2developer.com 1
More...

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Real Time Event Dispatcher Presentation Transcript

  • 1. Real Time Event Dispatcher
    • Pushing symfony events
    • in real time
    • to your clients
  • 2. Imagine Games Remember Google Wave? No? Anyone??? Read/Delete a message, all favicons change Your turn? Instant notification GMail Like „tail –f /var/log/my.log >some.browsers“
  • 3. IT‘S JUST SOOOO COOL!!! You click somewhere and immediately see a response somewhere else... Real Time Event Dispatcher
  • 4. @KaroDidi 1 wife, 2 kids, 3 monitors 34 years Day-Job: Working on Excel/Access VBA Applications :-/ True heart belongs to Web and PHP since >10 Years Own company/Freelancer www.smartpixelmedia.de Real-Life? Ah, right... Mountainbike Model plane/heli Peter Dietrich Real Time Event Dispatcher Hobbies: www.karopapier.de www.xosofox.de www.managerator.de www.tmeet.de www.timini.de www.beididi.de www.jobeet.de / www.symfony2.de www.d1d.li
  • 5. The Big Bicture Some PHP Some data transport Some JS Real Time Event Dispatcher sfBackend APE
  • 6. Real Time Event Dispatcher lib/model APE Custom Event Handler sfEventHandler Browser Browser Browser Throw Event HTTP Request JSON data Process Event Response on long-polling AJAX request Event bubbling through Browser Tab Browser Tab
  • 7. Real-Time?? Really really?
    • Yes, really really! *
    • Because it is not Polling! Data is being „pushed“!
    Real Time Event Dispatcher * Conditions apply: Network latency, Server load, …
  • 8. Polling?
    • „ Polling is just reverse Spam“
    Real Time Event Dispatcher Alexis Richardson http://www.rabbitmq.com/resources/RabbitMQ_Oxford_Geek_Night.pdf (Slide 23) http://www.ape-project.org/comics/1/Chapter-I-common-let-s-push.html
  • 9. AJAX Long Polling
    • POST /longpoll HTTP/1.1
    • .oO(ZZZZZZ) - Wait for data
    • Or close, send data, and wait
    • again
    Real Time Event Dispatcher Server Client 25s 25s POST Data Rx Data
  • 10. Comet Servers
    • APE (AJAX Push Engine, V2 coming, OSS)
    • node.js
    • StreamHub (Community Edition available)
    • Meteor (OSS)
    • Share your alternatives later?
    Real Time Event Dispatcher BTW, your Apache would of course instantly go down...
  • 11. What is APE?
    • www.ape-project.org
    • C, optimised for long-polling
    • Provides Server and Client JS Framework
    • Channels to listen on
    • Internally calls it „pipes“ – public and private (=sent to a channel or send to a „user“)
    Real Time Event Dispatcher http://www.xosofox.de/2010/03/playing-with-my-new-pet-ape/
  • 12. ... Some APE specifics
    • Functionality „by itself“ quite bare
    • Comes with some modules
    • Add Server Side JS
    • getPipeByUser?
    • You need to define your own user session handling to „send to username“
    Real Time Event Dispatcher http://www.xosofox.de/2010/10/ape-user-handling/
  • 13. Enough! Gimmi code!
    • Sf Event Dispatcher
    Real Time Event Dispatcher Dennis Benkert @denderello #sfLive2010 http://www.slideshare.net/denderello/symfony-live-2010-using-symfony-events-to-create-clean-class-interfaces
  • 14. ... More code
    • Custom Event Handler
    Real Time Event Dispatcher Event Payload Channel Define your payload here!
  • 15. ... Even more Code
    • Call to inline push on APE
    • JSON based
    • Need special commands on the server
    Real Time Event Dispatcher
  • 16. … Even more Code Real Time Event Dispatcher Event Payload Channel
  • 17. Server Side JS
    • Example of event dispatching
    Real Time Event Dispatcher Event Payload Channel
  • 18. Gimmi JS
    • Client Side APE_JSF EventHandler
    Real Time Event Dispatcher
  • 19. Gimmi JS
    • Do something
      • Change favicon
      • Add/Remove Elements
      • Redraw Canvas
      • Add to Log
    Real Time Event Dispatcher
  • 20. Some things to consider
    • Auth*ation
    • User-Handling, concurrent tabs?
    • Refresh < -- > Session resume
    • Channels
    • Public?
    • Page-Design
      • Reloads? => Reconnect => new session
      • Persistent overlay <div> with iframe?
    Real Time Event Dispatcher
  • 21. APE Alternatives?
    • node.js (bare)
      • socket.io (tries to find „best“ method, websockets, AJAX, Flash, ...)
    • RabbitMQ?
      • JSONRPC
      • Better ask @old_sound about that
      • RabbitMQ and APE could work together
    Real Time Event Dispatcher
  • 22. Psst... Annoying stuff
    • APE
      • APE Protocol takes some time to grasp
      • Little/confusing docs
      • Performance
    • General:
      • Browser parallel limits
      • Same origin (APE‘s workaround is *.domain.com)
      • Iframe
      • User/session handling
    Real Time Event Dispatcher
  • 23. Recap
    • Nice interaction between sf backend server, Comet server and Client
    • Interesting, different techniques involved
      • PHP Backend
      • JS Server side
      • JS Client side
    • Just soo cool – as soon as it works ;-)
    Real Time Event Dispatcher
  • 24. Further reading
    • Ape-project.org
    • Node.js
    • RabbitMQ
    Real Time Event Dispatcher
  • 25. There‘s one more thing
    • Questions?
    • Share your experience
    • If you like it, keep nagging @KaroDidi to release sfRealTimeEventDispatcherPlugin
    Real Time Event Dispatcher ... And please give http://tmeet.de/sflive a try