SlideShare una empresa de Scribd logo
1 de 11
Descargar para leer sin conexión
From	
  Web	
  sites	
  to	
  Web	
  apps	
  	
  
              in	
  Rails	
  
                Ambert	
  Ho	
  


                                   *all	
  images	
  were	
  has7ly	
  ripped	
  
                                   off	
  the	
  internet	
  and	
  belong	
  to	
  
                                   their	
  respec7ve	
  owner	
  
What	
  is	
  a	
  web	
  site	
  vs.	
  web	
  app?	
  
• Content	
  consump7on	
  vs.	
  interac7on?	
  
 	
  
      • Facebook	
  and	
  TwiCer	
  blur	
  the	
  line	
  
       	
  
Emerging	
  importance	
  of	
  ‘real7me’	
  
     I	
  use	
  this	
  term	
  loosely	
  since	
  ‘real7me’	
  has	
  
     predefined	
  meanings	
  in	
  terms	
  of	
  RTOS	
  

    • Applica7ons	
  should	
  change	
  state	
  
     	
  
    regardless	
  of	
  interac7on	
  
    • Even	
  for	
  content	
  sites:	
  
     	
  
           • TwiCer	
  and	
  Google	
  News	
  update	
  
            	
  
           themselves	
  while	
  you	
  look	
  at	
  it	
  
           • Same	
  with	
  Facebook	
  wall,	
  plus	
  FB	
  
            	
  
           no7fica7ons	
  
    • Previously,	
  ‘real7me’	
  primarily	
  used	
  
     	
  
    for	
  chat	
  
How	
  does	
  it	
  work?	
  
What	
  is	
  comet/reverse	
  ajax/ajax	
  
 push?	
  (‘push’	
  data	
  to	
  client)	
  
   • Long	
  polling	
  
    	
  




   • Websockets	
  
    	
  


   • (flash	
  sockets	
  too)	
  
    	
  
Details:	
  how	
  to	
  actually	
  go	
  about	
  
              doing	
  this?	
  
 • To	
  bolt	
  onto	
  Rails	
  you	
  need:	
  
  	
  
          1.  A	
  real7me	
  endpoint	
  (more	
  on	
  this	
  later)	
  	
  
          2.  Way	
  to	
  communicate	
  with	
  that	
  endpoint	
  
          3.  Clientside	
  code	
  organiza7on	
  to	
  process	
  what	
  happens	
  	
  




                      “Gimme	
  a	
  real	
  example”	
  
Juggernaut	
  
   • hCps://github.com/maccman/juggernaut	
  
    	
  
         • Used	
  to	
  be	
  EM,	
  now	
  uses	
  Node.js	
  
          	
  

Juggernaut	
  logic	
  
                                         Redis	
          Gem	
  for	
  interface	
  
      Node.JS	
  

Socket.IO	
  (server)	
  
                                                                      Rails	
  




     Socket.IO	
  (client)	
             Your	
  JS	
  


                            Client	
  
Event	
  Loop	
  
        (For	
  the	
  real7me	
  endpoint)                	
  	
  
• Why	
  not	
  use	
  Rails	
  all	
  the	
  way?	
  
 	
  

 • Your	
  web	
  server	
  spins	
  up	
  a	
  
  	
  
 worker	
  pool	
  of	
  en7re	
  Rails	
  
 instances	
  
        • #	
  persistent	
  connec7ons	
  limited	
  by	
  #	
  
         	
  
        Rails	
  instances	
  that	
  fit	
  in	
  memory	
  
                • spinning	
  up	
  Rails	
  also	
  takes	
  7me	
  
                  	
  
        • BeCer	
  with	
  REE	
  and	
  CoW	
  
         	
  
                                                  • Event	
  loops	
  excel	
  at	
  I/O	
  bound	
  
                                                   	
  
                                                  tasks*	
  
                                                         • Lot	
  of	
  simple	
  web	
  stuff,	
  par7cularly	
  
                                                          	
  
*It’s	
  more	
  complicated	
                           managing	
  connec7ons	
  like	
  with	
  ‘real7me’,	
  
If	
  you	
  want	
  to	
  know	
  why	
                 is	
  I/O	
  bound	
  
research	
  concurrency	
  on	
  JVM	
  
Review	
  on	
  ‘what	
  does	
  what’	
  
Rails,	
  using	
  the	
  Redis	
  gem	
  or	
  some	
  
                                                           Do	
  it	
  OOB?	
  (Net::HTTP	
  is	
  
wrapper	
  like	
  the	
  Juggernaut	
  gem,	
             blocking)	
  
publishes	
  to	
  Redis,	
  and	
  since	
  
Node.js	
  is	
  subscribed	
  it	
  gets	
  the	
  
message,	
  which	
  it	
  boots	
  to	
  the	
  
client	
  through	
  Socket.IO	
  –	
  the	
  
client	
  then	
  uses	
  a	
  framework	
  (like	
  
Backbone.js)	
  to	
  work	
  with	
  the	
  
piece	
  of	
  data.	
  

     • Backbone	
  is	
  designed	
  towards	
  
      	
  
     working	
  with	
  serialized	
  remote	
  
     data	
  
Alterna7ves	
  
• Pusher	
  
 	
  
   • Don’t	
  have	
  to	
  setup	
  Node	
  and	
  Redis	
  
    	
  
        • Considera7on	
  with	
  websockets	
  (HTTP	
  1.1)	
  and	
  
         	
  
        servers	
  proxied	
  behind	
  NGINX	
  
   • benefits	
  of	
  having	
  it	
  run	
  as	
  a	
  service,	
  but	
  costs	
  
    	
  
   $$$	
  
• Run	
  the	
  en7re	
  app	
  in	
  Node.js	
  
 	
  
      • LinkedIn	
  mobile	
  is	
  like	
  this	
  
       	
  
      • Consider	
  hos7ng	
  (Dotcloud,	
  Heroku,	
  
       	
  
      NodeJitsu)	
  
Slides
 http://www.slideshare.net/ambertch


Contact
  ambert@opzi.com


Discussion/Questions?

Más contenido relacionado

La actualidad más candente

BackboneJS and friends
BackboneJS and friendsBackboneJS and friends
BackboneJS and friendsScott Cowan
 
Modular & Event driven UI Architecture
Modular & Event driven UI ArchitectureModular & Event driven UI Architecture
Modular & Event driven UI ArchitectureVytautas Butkus
 
React.js - and how it changed our thinking about UI
React.js - and how it changed our thinking about UIReact.js - and how it changed our thinking about UI
React.js - and how it changed our thinking about UIMarcin Grzywaczewski
 
Flexible UI Components for a Multi-Framework World
Flexible UI Components for a Multi-Framework WorldFlexible UI Components for a Multi-Framework World
Flexible UI Components for a Multi-Framework WorldKevin Ball
 
How NOT to get lost in the current JavaScript landscape
How NOT to get lost in the current JavaScript landscapeHow NOT to get lost in the current JavaScript landscape
How NOT to get lost in the current JavaScript landscapeRadosław Scheibinger
 
Microservices with Apache Camel, Docker and Fabric8 v2
Microservices with Apache Camel, Docker and Fabric8 v2Microservices with Apache Camel, Docker and Fabric8 v2
Microservices with Apache Camel, Docker and Fabric8 v2Christian Posta
 
Kickstarting Node.js Projects with Yeoman
Kickstarting Node.js Projects with YeomanKickstarting Node.js Projects with Yeoman
Kickstarting Node.js Projects with YeomanPatrick Buergin
 
The Dark Side of Single Page Applications
The Dark Side of Single Page ApplicationsThe Dark Side of Single Page Applications
The Dark Side of Single Page ApplicationsDor Kalev
 
Modern javascript
Modern javascriptModern javascript
Modern javascriptKevin Ball
 
Server rendering-talk
Server rendering-talkServer rendering-talk
Server rendering-talkDaiwei Lu
 
OSGi, Scripting and REST, Building Webapps With Apache Sling
OSGi, Scripting and REST, Building Webapps With Apache SlingOSGi, Scripting and REST, Building Webapps With Apache Sling
OSGi, Scripting and REST, Building Webapps With Apache SlingCarsten Ziegeler
 
The Mobile Web - HTML5 on mobile devices
The Mobile Web - HTML5 on mobile devicesThe Mobile Web - HTML5 on mobile devices
The Mobile Web - HTML5 on mobile devicesWesley Hales
 
React server side rendering performance
React server side rendering performanceReact server side rendering performance
React server side rendering performanceNick Dreckshage
 
Build Your Own CMS with Apache Sling
Build Your Own CMS with Apache SlingBuild Your Own CMS with Apache Sling
Build Your Own CMS with Apache SlingBob Paulin
 
Backbone.js with React Views - Server Rendering, Virtual DOM, and More!
Backbone.js with React Views - Server Rendering, Virtual DOM, and More!Backbone.js with React Views - Server Rendering, Virtual DOM, and More!
Backbone.js with React Views - Server Rendering, Virtual DOM, and More!Ryan Roemer
 

La actualidad más candente (20)

Introduction to backbone js
Introduction to backbone jsIntroduction to backbone js
Introduction to backbone js
 
Wheel.js
Wheel.jsWheel.js
Wheel.js
 
Javascript for Wep Apps
Javascript for Wep AppsJavascript for Wep Apps
Javascript for Wep Apps
 
BackboneJS and friends
BackboneJS and friendsBackboneJS and friends
BackboneJS and friends
 
Modular & Event driven UI Architecture
Modular & Event driven UI ArchitectureModular & Event driven UI Architecture
Modular & Event driven UI Architecture
 
React.js - and how it changed our thinking about UI
React.js - and how it changed our thinking about UIReact.js - and how it changed our thinking about UI
React.js - and how it changed our thinking about UI
 
Backbonejs
BackbonejsBackbonejs
Backbonejs
 
Flexible UI Components for a Multi-Framework World
Flexible UI Components for a Multi-Framework WorldFlexible UI Components for a Multi-Framework World
Flexible UI Components for a Multi-Framework World
 
How NOT to get lost in the current JavaScript landscape
How NOT to get lost in the current JavaScript landscapeHow NOT to get lost in the current JavaScript landscape
How NOT to get lost in the current JavaScript landscape
 
Microservices with Apache Camel, Docker and Fabric8 v2
Microservices with Apache Camel, Docker and Fabric8 v2Microservices with Apache Camel, Docker and Fabric8 v2
Microservices with Apache Camel, Docker and Fabric8 v2
 
Kickstarting Node.js Projects with Yeoman
Kickstarting Node.js Projects with YeomanKickstarting Node.js Projects with Yeoman
Kickstarting Node.js Projects with Yeoman
 
The Dark Side of Single Page Applications
The Dark Side of Single Page ApplicationsThe Dark Side of Single Page Applications
The Dark Side of Single Page Applications
 
Modern javascript
Modern javascriptModern javascript
Modern javascript
 
Server rendering-talk
Server rendering-talkServer rendering-talk
Server rendering-talk
 
OSGi, Scripting and REST, Building Webapps With Apache Sling
OSGi, Scripting and REST, Building Webapps With Apache SlingOSGi, Scripting and REST, Building Webapps With Apache Sling
OSGi, Scripting and REST, Building Webapps With Apache Sling
 
The Mobile Web - HTML5 on mobile devices
The Mobile Web - HTML5 on mobile devicesThe Mobile Web - HTML5 on mobile devices
The Mobile Web - HTML5 on mobile devices
 
React server side rendering performance
React server side rendering performanceReact server side rendering performance
React server side rendering performance
 
Build Your Own CMS with Apache Sling
Build Your Own CMS with Apache SlingBuild Your Own CMS with Apache Sling
Build Your Own CMS with Apache Sling
 
Maven
Maven Maven
Maven
 
Backbone.js with React Views - Server Rendering, Virtual DOM, and More!
Backbone.js with React Views - Server Rendering, Virtual DOM, and More!Backbone.js with React Views - Server Rendering, Virtual DOM, and More!
Backbone.js with React Views - Server Rendering, Virtual DOM, and More!
 

Similar a Realtime web apps rails

Developing realtime apps with Drupal and NodeJS
Developing realtime apps with Drupal and NodeJS Developing realtime apps with Drupal and NodeJS
Developing realtime apps with Drupal and NodeJS drupalcampest
 
Introduction To J Boss Seam
Introduction To J Boss SeamIntroduction To J Boss Seam
Introduction To J Boss Seamashishkulkarni
 
Isomorphic JavaScript – future of the web
Isomorphic JavaScript – future of the webIsomorphic JavaScript – future of the web
Isomorphic JavaScript – future of the webSigma Software
 
Real-Time with Flowdock
Real-Time with FlowdockReal-Time with Flowdock
Real-Time with FlowdockFlowdock
 
Practical Use of MongoDB for Node.js
Practical Use of MongoDB for Node.jsPractical Use of MongoDB for Node.js
Practical Use of MongoDB for Node.jsasync_io
 
Evented Ruby VS Node.js
Evented Ruby VS Node.jsEvented Ruby VS Node.js
Evented Ruby VS Node.jsNitin Gupta
 
Fast, concurrent ruby web applications with EventMachine and EM::Synchrony
Fast, concurrent ruby web applications with EventMachine and EM::SynchronyFast, concurrent ruby web applications with EventMachine and EM::Synchrony
Fast, concurrent ruby web applications with EventMachine and EM::SynchronyKyle Drake
 
IBM and Node.js - Old Doge, New Tricks
IBM and Node.js - Old Doge, New TricksIBM and Node.js - Old Doge, New Tricks
IBM and Node.js - Old Doge, New TricksDejan Glozic
 
Станислав Сидоренко «DeviceHive Java Server – миграция на Spring Boot»
Станислав Сидоренко «DeviceHive Java Server – миграция на Spring Boot»Станислав Сидоренко «DeviceHive Java Server – миграция на Spring Boot»
Станислав Сидоренко «DeviceHive Java Server – миграция на Spring Boot»DataArt
 
JavaOne 2011 - Going Mobile With Java Based Technologies Today
JavaOne 2011 - Going Mobile With Java Based Technologies TodayJavaOne 2011 - Going Mobile With Java Based Technologies Today
JavaOne 2011 - Going Mobile With Java Based Technologies TodayWesley Hales
 
WebSockets wiith Scala and Play! Framework
WebSockets wiith Scala and Play! FrameworkWebSockets wiith Scala and Play! Framework
WebSockets wiith Scala and Play! FrameworkFabio Tiriticco
 
Phonegap for Engineers
Phonegap for EngineersPhonegap for Engineers
Phonegap for EngineersBrian LeRoux
 

Similar a Realtime web apps rails (20)

20120802 timisoara
20120802 timisoara20120802 timisoara
20120802 timisoara
 
Developing realtime apps with Drupal and NodeJS
Developing realtime apps with Drupal and NodeJS Developing realtime apps with Drupal and NodeJS
Developing realtime apps with Drupal and NodeJS
 
Introduction To J Boss Seam
Introduction To J Boss SeamIntroduction To J Boss Seam
Introduction To J Boss Seam
 
20120306 dublin js
20120306 dublin js20120306 dublin js
20120306 dublin js
 
Isomorphic JavaScript – future of the web
Isomorphic JavaScript – future of the webIsomorphic JavaScript – future of the web
Isomorphic JavaScript – future of the web
 
Deno Crate Organization
Deno Crate OrganizationDeno Crate Organization
Deno Crate Organization
 
Real-Time with Flowdock
Real-Time with FlowdockReal-Time with Flowdock
Real-Time with Flowdock
 
React Tech Salon
React Tech SalonReact Tech Salon
React Tech Salon
 
Practical Use of MongoDB for Node.js
Practical Use of MongoDB for Node.jsPractical Use of MongoDB for Node.js
Practical Use of MongoDB for Node.js
 
Evented Ruby VS Node.js
Evented Ruby VS Node.jsEvented Ruby VS Node.js
Evented Ruby VS Node.js
 
Fast, concurrent ruby web applications with EventMachine and EM::Synchrony
Fast, concurrent ruby web applications with EventMachine and EM::SynchronyFast, concurrent ruby web applications with EventMachine and EM::Synchrony
Fast, concurrent ruby web applications with EventMachine and EM::Synchrony
 
IBM and Node.js - Old Doge, New Tricks
IBM and Node.js - Old Doge, New TricksIBM and Node.js - Old Doge, New Tricks
IBM and Node.js - Old Doge, New Tricks
 
Intro to Sails.js
Intro to Sails.jsIntro to Sails.js
Intro to Sails.js
 
NodeJS and what is actually does
NodeJS and what is actually doesNodeJS and what is actually does
NodeJS and what is actually does
 
Станислав Сидоренко «DeviceHive Java Server – миграция на Spring Boot»
Станислав Сидоренко «DeviceHive Java Server – миграция на Spring Boot»Станислав Сидоренко «DeviceHive Java Server – миграция на Spring Boot»
Станислав Сидоренко «DeviceHive Java Server – миграция на Spring Boot»
 
JavaOne 2011 - Going Mobile With Java Based Technologies Today
JavaOne 2011 - Going Mobile With Java Based Technologies TodayJavaOne 2011 - Going Mobile With Java Based Technologies Today
JavaOne 2011 - Going Mobile With Java Based Technologies Today
 
WebSockets wiith Scala and Play! Framework
WebSockets wiith Scala and Play! FrameworkWebSockets wiith Scala and Play! Framework
WebSockets wiith Scala and Play! Framework
 
Phonegap for Engineers
Phonegap for EngineersPhonegap for Engineers
Phonegap for Engineers
 
React.js at Cortex
React.js at CortexReact.js at Cortex
React.js at Cortex
 
Node js
Node jsNode js
Node js
 

Último

Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DaySri Ambati
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 

Último (20)

Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 

Realtime web apps rails

  • 1. From  Web  sites  to  Web  apps     in  Rails   Ambert  Ho   *all  images  were  has7ly  ripped   off  the  internet  and  belong  to   their  respec7ve  owner  
  • 2. What  is  a  web  site  vs.  web  app?   • Content  consump7on  vs.  interac7on?     • Facebook  and  TwiCer  blur  the  line    
  • 3. Emerging  importance  of  ‘real7me’   I  use  this  term  loosely  since  ‘real7me’  has   predefined  meanings  in  terms  of  RTOS   • Applica7ons  should  change  state     regardless  of  interac7on   • Even  for  content  sites:     • TwiCer  and  Google  News  update     themselves  while  you  look  at  it   • Same  with  Facebook  wall,  plus  FB     no7fica7ons   • Previously,  ‘real7me’  primarily  used     for  chat  
  • 4. How  does  it  work?  
  • 5. What  is  comet/reverse  ajax/ajax   push?  (‘push’  data  to  client)   • Long  polling     • Websockets     • (flash  sockets  too)    
  • 6. Details:  how  to  actually  go  about   doing  this?   • To  bolt  onto  Rails  you  need:     1.  A  real7me  endpoint  (more  on  this  later)     2.  Way  to  communicate  with  that  endpoint   3.  Clientside  code  organiza7on  to  process  what  happens     “Gimme  a  real  example”  
  • 7. Juggernaut   • hCps://github.com/maccman/juggernaut     • Used  to  be  EM,  now  uses  Node.js     Juggernaut  logic   Redis   Gem  for  interface   Node.JS   Socket.IO  (server)   Rails   Socket.IO  (client)   Your  JS   Client  
  • 8. Event  Loop   (For  the  real7me  endpoint)     • Why  not  use  Rails  all  the  way?     • Your  web  server  spins  up  a     worker  pool  of  en7re  Rails   instances   • #  persistent  connec7ons  limited  by  #     Rails  instances  that  fit  in  memory   • spinning  up  Rails  also  takes  7me     • BeCer  with  REE  and  CoW     • Event  loops  excel  at  I/O  bound     tasks*   • Lot  of  simple  web  stuff,  par7cularly     *It’s  more  complicated   managing  connec7ons  like  with  ‘real7me’,   If  you  want  to  know  why   is  I/O  bound   research  concurrency  on  JVM  
  • 9. Review  on  ‘what  does  what’   Rails,  using  the  Redis  gem  or  some   Do  it  OOB?  (Net::HTTP  is   wrapper  like  the  Juggernaut  gem,   blocking)   publishes  to  Redis,  and  since   Node.js  is  subscribed  it  gets  the   message,  which  it  boots  to  the   client  through  Socket.IO  –  the   client  then  uses  a  framework  (like   Backbone.js)  to  work  with  the   piece  of  data.   • Backbone  is  designed  towards     working  with  serialized  remote   data  
  • 10. Alterna7ves   • Pusher     • Don’t  have  to  setup  Node  and  Redis     • Considera7on  with  websockets  (HTTP  1.1)  and     servers  proxied  behind  NGINX   • benefits  of  having  it  run  as  a  service,  but  costs     $$$   • Run  the  en7re  app  in  Node.js     • LinkedIn  mobile  is  like  this     • Consider  hos7ng  (Dotcloud,  Heroku,     NodeJitsu)  
  • 11. Slides http://www.slideshare.net/ambertch Contact ambert@opzi.com Discussion/Questions?