railsconf europe 2008 juggernaut realtime rails
play

RailsConf Europe 2008 Juggernaut Realtime Rails Alex MacCaw and - PowerPoint PPT Presentation

RailsConf Europe 2008 Juggernaut Realtime Rails Alex MacCaw and Stuart Eccles RailsConf Europe 2008 Juggernaut Realtime Rails Alex MacCaw and Stuart Eccles http://www.madebymany.co.uk/ server push HTTP HTTP GET/POST <html/>


  1. RailsConf Europe 2008 Juggernaut Realtime Rails Alex MacCaw and Stuart Eccles

  2. RailsConf Europe 2008 Juggernaut Realtime Rails Alex MacCaw and Stuart Eccles

  3. http://www.madebymany.co.uk/

  4. server push

  5. HTTP HTTP GET/POST <html/> <script/> Client Server

  6. Server Push Client Server

  7. what is Juggernaut?

  8. History Written by Alex MacCaw in 2006 Published at http://juggernaut.rubyforge.org/ Latest versions at GitHub just for Edge Rails MIT License

  9. 3 Components Invisible Juggernaut Rails Plugin Flash SWF Server Client Messenger Broadcaster

  10. Juggernaut is also

  11. This guy.... what do we want?

  12. This guy.... what do we want?

  13. X-Men Character

  14. X-Men Character

  15. the other Juggernaut?

  16. real world users

  17. Collaboration

  18. Real Time Interaction

  19. Multiplayer Games

  20. Multiplayer Games

  21. Chat

  22. Real Time Activity Feeds

  23. Enhancing Traditional Media

  24. juggernaut competition

  25. r e s o u i n r c t e e n s i v e

  26. r e s o u i n r c t e e n s i v e not realtime

  27. F i r e f m o x e m o i r s y s u e s

  28. F i r e f m o x e m o i r s y s u e s not cross- domain

  29. F i r e f m o x e m o i r s y s u e s IE clicking not cross- domain

  30. F i r e f m o x e m max 2 o i r s y s u streams in e s IE IE clicking not cross- domain

  31. features browser compatibility Flash 8 > 95% of all browsers cross-OS Prototype and JQuery versions

  32. features scale with eventmachine 30k concurrent users and clustering support

  33. features channels client can subscribe to one or more channels Broadcast can be channel selected Broadcast can even be client selected

  34. features authentication IP whitelist shared secrets authentication callbacks

  35. features callbacks client connect callback client disconnect callback

  36. features queries query server for list of clients

  37. in pictures

  38. Rails Application Juggernaut Rails Plugin Juggernaut Push Server

  39. Rails Application Juggernaut Rails Plugin Juggernaut Push Server

  40. GET Rails Application Juggernaut Rails Plugin Juggernaut Push Server

  41. OK Rails Application Juggernaut Rails Plugin Juggernaut Push Server

  42. SUBSCRIBE Rails Application Juggernaut Rails Plugin Juggernaut Push Server

  43. Rails Application DUPLEX Juggernaut Rails Plugin Juggernaut Push Server

  44. Rails Application DUPLEX Juggernaut Rails Plugin callback Juggernaut Push Server

  45. Rails Application DUPLEX Juggernaut Rails Plugin SUBSCRIBE Juggernaut Push Server

  46. Rails Application DUPLEX Juggernaut Rails Plugin callback DUPLEX Juggernaut Push Server

  47. Rails Application RJS DUPLEX Juggernaut Rails Plugin JSON MESSAGE DUPLEX Juggernaut Push Server

  48. Rails Application DUPLEX Juggernaut Rails Plugin S J DUPLEX Juggernaut Push Server

  49. S J Rails Application DUPLEX Juggernaut Rails Plugin DUPLEX Juggernaut Push Server

  50. Wonder-women has entered chat Rails Application DUPLEX Juggernaut Rails Plugin S J DUPLEX Juggernaut Push Server

  51. Wonder-women has entered chat S J Rails Application DUPLEX Juggernaut Rails Plugin DUPLEX Juggernaut Push Server

  52. Rails Application DUPLEX Juggernaut Rails Plugin DUPLEX Juggernaut Push Server

  53. Rails Application DUPLEX Juggernaut Rails Plugin DUPLEX Juggernaut Push Server DUPLEX

  54. AJAX Rails Application DUPLEX Juggernaut Rails Plugin DUPLEX Juggernaut Push Server DUPLEX

  55. Rails Application RJS DUPLEX Juggernaut Rails Plugin JSON MESSAGE DUPLEX Juggernaut Push Server DUPLEX

  56. Rails Application DUPLEX Juggernaut Rails Plugin S J DUPLEX S Juggernaut Push J Server S J DUPLEX

  57. Rails Application DUPLEX Juggernaut Rails Plugin S J DUPLEX S Juggernaut Push J Server S J DUPLEX

  58. Rails Application DUPLEX Juggernaut Rails Plugin S J S J DUPLEX Juggernaut Push Server S J DUPLEX

  59. S J Rails Application DUPLEX Juggernaut Rails Plugin S J DUPLEX Juggernaut Push Server S J DUPLEX

  60. SuperMan says ‘Hi!’ Rails Application SuperMan says ‘Hi!’ DUPLEX Juggernaut Rails Plugin DUPLEX Juggernaut Push SuperMan says ‘Hi!’ Server DUPLEX

  61. Rails Application DUPLEX Juggernaut Rails Plugin DUPLEX Juggernaut Push Server DUPLEX

  62. Rails Application DUPLEX Juggernaut Rails Plugin DUPLEX Juggernaut Push Server DUPLEX

  63. RAKE Rails Application DUPLEX Juggernaut Rails Plugin DUPLEX Juggernaut Push Server DUPLEX

  64. Rails Application RJS DUPLEX Juggernaut Rails Plugin JSON MESSAGE DUPLEX Juggernaut Push Server DUPLEX

  65. Rails Application DUPLEX Juggernaut Rails Plugin S J DUPLEX S Juggernaut Push J Server S J DUPLEX

  66. Rails Application DUPLEX Juggernaut Rails Plugin S J DUPLEX S Juggernaut Push J Server S J DUPLEX

  67. Rails Application DUPLEX Juggernaut Rails Plugin S J S J DUPLEX Juggernaut Push Server S J DUPLEX

  68. S J Rails Application DUPLEX Juggernaut Rails Plugin S J DUPLEX Juggernaut Push Server S J DUPLEX

  69. Chat will be closing in 10 minutes! Rails Application Chat will be closing in 10 minutes! DUPLEX Juggernaut Rails Plugin DUPLEX Juggernaut Push Chat will be closing in 10 minutes! Server DUPLEX

  70. Rails Application DUPLEX Juggernaut Rails Plugin DUPLEX Juggernaut Push Server DUPLEX

  71. Rails Application DUPLEX Juggernaut Rails Plugin DUPLEX Juggernaut Push Server DUPLEX

  72. notification Rails Application DUPLEX Juggernaut Rails Plugin DUPLEX Juggernaut Push Server DUPLEX

  73. Rails Application Juggernaut Rails Plugin callback DUPLEX Juggernaut Push Server DUPLEX

  74. Rails Application RJS Juggernaut Rails Plugin JSON MESSAGE DUPLEX Juggernaut Push Server DUPLEX

  75. Rails Application Juggernaut Rails Plugin DUPLEX S Juggernaut Push J Server S J DUPLEX

  76. Rails Application Juggernaut Rails Plugin DUPLEX S Juggernaut Push J Server S J DUPLEX

  77. Rails Application Juggernaut Rails Plugin S J DUPLEX Juggernaut Push Server S J DUPLEX

  78. Rails Application SuperMan has left the building! Juggernaut Rails Plugin DUPLEX Juggernaut Push SuperMan has left the building! Server DUPLEX

  79. Audience Participation http://railsconf.madebymany.co.uk

  80. def code

  81. Partial Update Example

  82. Install Juggernaut script/plugin install \ http://juggernaut.rubyforge.org/svn/trunk/juggernaut sudo gem install juggernaut (includes json and eventmachine dependencies)

  83. Start the Push Server juggernaut -g juggernaut.yml juggernaut -c juggernaut.yml

  84. View <html> <head> <%= javascript_include_tag :defaults, :juggernaut %> <%= juggernaut %> </head>

  85. Controller render :juggernaut do |page| page.replace 'person-45', :partial => 'person' end

  86. That’s it!

  87. Demo 1: Chat

  88. Subscribe to channels <%= juggernaut(:channels => ['one', 'two', 'three']) %>

  89. Broadcast to channels render :juggernaut => { :type => :send_to_channels, :channels => ['one'] } do |page| page.alert('Hello World') end

  90. Subscribe as a particular client <%= juggernaut(:client_id => current_user.id) %>

  91. Broadcast to a particular client render :juggernaut => { :type => :send_to_client, :client_id => @user.id } do |page| page.alert('Hello World') end

  92. Find connected clients Juggernaut.show_clients

  93. Don’t want inline RJS? render_juggernaut('person_update.rjs')

  94. Don’t Want RJS? Juggernaut.send_to_all(“alert(‘foo’);”) Juggernaut.send_to_client(“alert(‘foo’);”, @user.id) Juggernaut.send_to_channel(“alert(‘foo’);”, @channel)

  95. Demo 2: Google Maps http://railsconf.madebymany.co.uk

  96. tips

  97. Don’t push huge amounts of HTML to the browser. Trigger an AJAX request instead Don’t push huge amounts of Javascript to the browser. Trigger a function call already loaded by the browser. In callbacks Juggernaut will pass the session id so you can use existing session information. Escape your user inputs!! XSS is very dangerous in a Push JavaScript world.

  98. http://juggernaut.rubyforge.org/ Thank You! Q & A

Recommend


More recommend