bringing interactivity to your drupal site with node.js integration
DESCRIPTION
Drupal is a powerful, flexible platform for building applications, but not something that handles realtime notifications easily. Node.js is a breath of fresh air in the Open Source web server landscape. It makes writing applications that handle thousands of open connections at the same time easily.The Nodejs module integrates Drupal with Node.js, allowing for the best of both worlds. Realtime chat, push notifications and help desk functionality can all be easily added to your Drupal site via the Nodejs module, without the usual scalability and performance issues associated with these technologies on the LAMP stack.TRANSCRIPT
![Page 1: Bringing Interactivity to Your Drupal Site with Node.js Integration](https://reader034.vdocuments.us/reader034/viewer/2022042607/554f9293b4c905d25b8b52a5/html5/thumbnails/1.jpg)
Bring real-time interactivity to Drupal with Node.js
Howard Tyson, senior developer, ZivtechKieran Lal, technical director, enterprise sales
![Page 2: Bringing Interactivity to Your Drupal Site with Node.js Integration](https://reader034.vdocuments.us/reader034/viewer/2022042607/554f9293b4c905d25b8b52a5/html5/thumbnails/2.jpg)
Upcoming Webinars
• Drupal in the Trenches: Solving Real World Problems
• Five websites you can launch on Dev Cloud without Coding
• Selecting the Right Solution to Build your Online Developer Community
• Easy Drupal Hosting Lifecycle
• From PSD to Drupal Theme
• Four Open Source Drupal Applications for Higher Ed
http://acquia.com/resources/webinars
![Page 3: Bringing Interactivity to Your Drupal Site with Node.js Integration](https://reader034.vdocuments.us/reader034/viewer/2022042607/554f9293b4c905d25b8b52a5/html5/thumbnails/3.jpg)
Upcoming Node.js Webinars
• Lessons learned integrating Drupal with Node.js and MongoDB powered Web Services
• Lior Kesos, Swifto, founder Linnovate
• November 9th, 2011
http://acquia.com/resources/webinars
![Page 4: Bringing Interactivity to Your Drupal Site with Node.js Integration](https://reader034.vdocuments.us/reader034/viewer/2022042607/554f9293b4c905d25b8b52a5/html5/thumbnails/4.jpg)
Howard Tyson
• Howard Tyson, Senior Developer at Zivtech
• Developing Drupal powered websites since 2006.
• Howard contributes to Drupal and co-‐maintains the Nodejs module, Version Control API among others.
• Version control powers Git repository on Drupal.org which has added 6000 more developers since Jan, 2011
![Page 5: Bringing Interactivity to Your Drupal Site with Node.js Integration](https://reader034.vdocuments.us/reader034/viewer/2022042607/554f9293b4c905d25b8b52a5/html5/thumbnails/5.jpg)
![Page 6: Bringing Interactivity to Your Drupal Site with Node.js Integration](https://reader034.vdocuments.us/reader034/viewer/2022042607/554f9293b4c905d25b8b52a5/html5/thumbnails/6.jpg)
Node.js & DrupalDrupal in realtime via Node.js
![Page 7: Bringing Interactivity to Your Drupal Site with Node.js Integration](https://reader034.vdocuments.us/reader034/viewer/2022042607/554f9293b4c905d25b8b52a5/html5/thumbnails/7.jpg)
WhoWho am I?
![Page 8: Bringing Interactivity to Your Drupal Site with Node.js Integration](https://reader034.vdocuments.us/reader034/viewer/2022042607/554f9293b4c905d25b8b52a5/html5/thumbnails/8.jpg)
Howard Tyson
•Drupal.org, twitter, IRC: tizzo
•Senior Developer at Zivtech
•Drupal & systems architect, trainer
![Page 9: Bringing Interactivity to Your Drupal Site with Node.js Integration](https://reader034.vdocuments.us/reader034/viewer/2022042607/554f9293b4c905d25b8b52a5/html5/thumbnails/9.jpg)
Zivtech
•Drupal experts
•Open source enthusiasts (node.js, Alfresco, Zend, Python, etc).
•Excellent web/mobile design team
•Offer public and private trainings focused on turning smart people into excellent developers
![Page 10: Bringing Interactivity to Your Drupal Site with Node.js Integration](https://reader034.vdocuments.us/reader034/viewer/2022042607/554f9293b4c905d25b8b52a5/html5/thumbnails/10.jpg)
WhatWhat is Node.js everyone is talking about,
anyway?
![Page 11: Bringing Interactivity to Your Drupal Site with Node.js Integration](https://reader034.vdocuments.us/reader034/viewer/2022042607/554f9293b4c905d25b8b52a5/html5/thumbnails/11.jpg)
Node.js
•Javascript on the server
•Based on Google’s V8 engine
•Event driven
•Asynchronous I/O performed by libraries
![Page 12: Bringing Interactivity to Your Drupal Site with Node.js Integration](https://reader034.vdocuments.us/reader034/viewer/2022042607/554f9293b4c905d25b8b52a5/html5/thumbnails/12.jpg)
Architecture
node standard library
JavaScript C/C++
node bindings provided by modules(socket, http, etc)
thread pool
your code
![Page 13: Bringing Interactivity to Your Drupal Site with Node.js Integration](https://reader034.vdocuments.us/reader034/viewer/2022042607/554f9293b4c905d25b8b52a5/html5/thumbnails/13.jpg)
Architecture
•A single process runs the main event loop and maintains all connections
•Tasks are performed asynchronously by workers in a thread pool managed by a library leaving the main event loop free to handle other requests
![Page 14: Bringing Interactivity to Your Drupal Site with Node.js Integration](https://reader034.vdocuments.us/reader034/viewer/2022042607/554f9293b4c905d25b8b52a5/html5/thumbnails/14.jpg)
Node.js hello world
•Writing a web server was never so easy!
![Page 15: Bringing Interactivity to Your Drupal Site with Node.js Integration](https://reader034.vdocuments.us/reader034/viewer/2022042607/554f9293b4c905d25b8b52a5/html5/thumbnails/15.jpg)
WhyWe already have Apache, why is this helpful?
![Page 16: Bringing Interactivity to Your Drupal Site with Node.js Integration](https://reader034.vdocuments.us/reader034/viewer/2022042607/554f9293b4c905d25b8b52a5/html5/thumbnails/16.jpg)
Why we care about realtime?
•Users expect more and more (they see it on Facebook, Twitter, Google, etc. every day)
•Great for mobile
•Bridge the native app gap
![Page 17: Bringing Interactivity to Your Drupal Site with Node.js Integration](https://reader034.vdocuments.us/reader034/viewer/2022042607/554f9293b4c905d25b8b52a5/html5/thumbnails/17.jpg)
A Use Case• Dignio
• A service for improving life for patience needing additional care but not assisted living
• Realtime webapp for call center employees, patients
![Page 18: Bringing Interactivity to Your Drupal Site with Node.js Integration](https://reader034.vdocuments.us/reader034/viewer/2022042607/554f9293b4c905d25b8b52a5/html5/thumbnails/18.jpg)
Apache’s Shortcomings
• One thread (usually one process) per connection
• Memory heavy processes (for Drupal especially)
• Persistent and concurrent connections are
![Page 19: Bringing Interactivity to Your Drupal Site with Node.js Integration](https://reader034.vdocuments.us/reader034/viewer/2022042607/554f9293b4c905d25b8b52a5/html5/thumbnails/19.jpg)
Node.js is good for...
• Concurrency!
• Asynchronous I/O
• Low overhead for open connections
• Light weight servers
• Networking applications
![Page 20: Bringing Interactivity to Your Drupal Site with Node.js Integration](https://reader034.vdocuments.us/reader034/viewer/2022042607/554f9293b4c905d25b8b52a5/html5/thumbnails/20.jpg)
Node.js is good for...
•Backend workers or serving clients
•Node.js has a vibrant community writing extensions (often you just need to write some glue, sound familiar?)
•Wherever Drupal’s power comes at too high a price
![Page 21: Bringing Interactivity to Your Drupal Site with Node.js Integration](https://reader034.vdocuments.us/reader034/viewer/2022042607/554f9293b4c905d25b8b52a5/html5/thumbnails/21.jpg)
HowHow do we use node.js with Drupal?
![Page 22: Bringing Interactivity to Your Drupal Site with Node.js Integration](https://reader034.vdocuments.us/reader034/viewer/2022042607/554f9293b4c905d25b8b52a5/html5/thumbnails/22.jpg)
Integarting with node.js
•Write your own node.js server
•if you know javascript, it’s not so hard!
•Use drupal’s node.js module for realtime communications
![Page 23: Bringing Interactivity to Your Drupal Site with Node.js Integration](https://reader034.vdocuments.us/reader034/viewer/2022042607/554f9293b4c905d25b8b52a5/html5/thumbnails/23.jpg)
The Node.js module
•The node.js module on Drupal.org
•http://drupal.org/project/nodejs
•Focused on realtime updates for Drupal
•Provides a node.js server and a Drupal module that integrates with it
![Page 24: Bringing Interactivity to Your Drupal Site with Node.js Integration](https://reader034.vdocuments.us/reader034/viewer/2022042607/554f9293b4c905d25b8b52a5/html5/thumbnails/24.jpg)
Realtime?
•Until now, when a client opens a page they don’t see updates until the next time they refresh the page
•Our module can push content to someone while they view the page
![Page 25: Bringing Interactivity to Your Drupal Site with Node.js Integration](https://reader034.vdocuments.us/reader034/viewer/2022042607/554f9293b4c905d25b8b52a5/html5/thumbnails/25.jpg)
1. Normal Drupal Page Load
(with auth token)
3. Node.js sends auth token to
Drupal
2. Connection requested by
socket.io using auth token
4. Drupal returns a list of channels for
the user
5. Node.js notifies client that auth is
successful
Authentication
![Page 26: Bringing Interactivity to Your Drupal Site with Node.js Integration](https://reader034.vdocuments.us/reader034/viewer/2022042607/554f9293b4c905d25b8b52a5/html5/thumbnails/26.jpg)
1. Normal Drupal Page Load
(with auth token)
2. Node.js remembers the authenticated
token, authenticating the user without a
need to query Drupal again
Subsequent pages
![Page 27: Bringing Interactivity to Your Drupal Site with Node.js Integration](https://reader034.vdocuments.us/reader034/viewer/2022042607/554f9293b4c905d25b8b52a5/html5/thumbnails/27.jpg)
Client Apache / Nginx
Node.js
Client requests Drupal page
Drupal sends down HTML with JS token
Client sends auth token to Node.js
Node.js verifies token with Drupal
Drupal sends appropriate
channels for the user
Subsequent connections do not hit Drupal
Node.js notifies the client of
successful auth
Node.js ServerWeb browser Apache Server
![Page 28: Bringing Interactivity to Your Drupal Site with Node.js Integration](https://reader034.vdocuments.us/reader034/viewer/2022042607/554f9293b4c905d25b8b52a5/html5/thumbnails/28.jpg)
WhereWhere can my code hook in to leverage
Node.js?
![Page 29: Bringing Interactivity to Your Drupal Site with Node.js Integration](https://reader034.vdocuments.us/reader034/viewer/2022042607/554f9293b4c905d25b8b52a5/html5/thumbnails/29.jpg)
PHP
![Page 30: Bringing Interactivity to Your Drupal Site with Node.js Integration](https://reader034.vdocuments.us/reader034/viewer/2022042607/554f9293b4c905d25b8b52a5/html5/thumbnails/30.jpg)
JavaScript
![Page 31: Bringing Interactivity to Your Drupal Site with Node.js Integration](https://reader034.vdocuments.us/reader034/viewer/2022042607/554f9293b4c905d25b8b52a5/html5/thumbnails/31.jpg)
Add a user to a channel
![Page 32: Bringing Interactivity to Your Drupal Site with Node.js Integration](https://reader034.vdocuments.us/reader034/viewer/2022042607/554f9293b4c905d25b8b52a5/html5/thumbnails/32.jpg)
Message only the channel
![Page 33: Bringing Interactivity to Your Drupal Site with Node.js Integration](https://reader034.vdocuments.us/reader034/viewer/2022042607/554f9293b4c905d25b8b52a5/html5/thumbnails/33.jpg)
WhenAre we getting new features?
![Page 34: Bringing Interactivity to Your Drupal Site with Node.js Integration](https://reader034.vdocuments.us/reader034/viewer/2022042607/554f9293b4c905d25b8b52a5/html5/thumbnails/34.jpg)
What’s coming
•Version 1.0 is right around the corner
•we’re on beta5
•Chatroom is undergoing a refactor to rely on a push capable backend (like node.js)
![Page 35: Bringing Interactivity to Your Drupal Site with Node.js Integration](https://reader034.vdocuments.us/reader034/viewer/2022042607/554f9293b4c905d25b8b52a5/html5/thumbnails/35.jpg)
New Features
•Content channels (recently landed)
•Views integration
•Generic entity updating
•Your module here...
![Page 36: Bringing Interactivity to Your Drupal Site with Node.js Integration](https://reader034.vdocuments.us/reader034/viewer/2022042607/554f9293b4c905d25b8b52a5/html5/thumbnails/36.jpg)
Call to action!
•We need:
•Contributors!
•Documentation writers!
•Testers!
•http://drupal.org/project/nodejs
•http://drupal.org/project/chatroom
![Page 37: Bringing Interactivity to Your Drupal Site with Node.js Integration](https://reader034.vdocuments.us/reader034/viewer/2022042607/554f9293b4c905d25b8b52a5/html5/thumbnails/37.jpg)
DemoLet’s see it in action!
![Page 38: Bringing Interactivity to Your Drupal Site with Node.js Integration](https://reader034.vdocuments.us/reader034/viewer/2022042607/554f9293b4c905d25b8b52a5/html5/thumbnails/38.jpg)
Questions
• For more information visit: http://www.acquia.com
• Follow us: http://www.twitter.com/acquia
• Contact us: [email protected] or 888.9.ACQUIA
• Howard Tyson [email protected]
• Kieran Lal, [email protected], 415-‐992-‐8124
• follow: amazonk
Today’s webinar recording will be posted to:http://acquia.com/resources/recorded_webinars