real time event dispatcher
Post on 05-Dec-2014
5.969 Views
Preview:
DESCRIPTION
Pushing symfony events in real time to your clientsThis 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
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. ITS 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!
- 8. Polling?
- Polling is just reverse Spam
- 9. AJAX Long Polling
- POST /longpoll HTTP/1.1
- .oO(ZZZZZZ) - Wait for data
- Or close, send data, and wait
- again
- 10. Comet Servers
- APE (AJAX Push Engine, V2 coming, OSS)
- node.js
- StreamHub (Community Edition available)
- Meteor (OSS)
- Share your alternatives later?
- 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)
- 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
- 13. Enough! Gimmi code!
- Sf Event Dispatcher
- 14. ... More code
- Custom Event Handler
- 15. ... Even more Code
- Call to inline push on APE
- JSON based
- Need special commands on the server
- 16. Even more Code Real Time Event Dispatcher Event Payload Channel
- 17. Server Side JS
- Example of event dispatching
- 18. Gimmi JS
- Client Side APE_JSF EventHandler
- 19. Gimmi JS
- Do something
-
- Change favicon
-
- Add/Remove Elements
-
- Redraw Canvas
-
- Add to Log
- 20. Some things to consider
- Auth*ation
- User-Handling, concurrent tabs?
- Refresh < -- > Session resume
- Channels
- Public?
- Page-Design
-
- Reloads? => Reconnect => new session
-
- Persistent overlay
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
- 22. Psst... Annoying stuff
- APE
-
- APE Protocol takes some time to grasp
-
- Little/confusing docs
-
- Performance
- General:
-
- Browser parallel limits
-
- Same origin (APEs workaround is *.domain.com)
-
- Iframe
-
- User/session handling
- 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 ;-)
- 24. Further reading
- Ape-project.org
- Node.js
- RabbitMQ
- 25. Theres one more thing
- Questions?
- Share your experience
- If you like it, keep nagging @KaroDidi to release sfRealTimeEventDispatcherPlugin
- Persistent overlay
top related