Check your version

This video covers a topic in Drupal 7 which may or may not be the version you're using. We're keeping this tutorial online as a courtesy to users of Drupal 7, but we consider it archived.

Alternate resources: 

What Is Node.js?

Video loading...

  • 0:02
    What is Node.js? with William Hetherington
  • 0:04
    In this lesson,
  • 0:05
    we're going to learn about what Node.js is.
  • 0:07
    We're also going to learn about what NPM is.
  • 0:10
    And then we're going to take a quick overview
  • 0:12
    of the Node.js Integration Drupal module.
  • 0:14
    So I've popped open a browser, and I'm at,
  • 0:18
    which is the home page for the Node.js project.
  • 0:20
    If you read the description at the top,
  • 0:22
    Node.js is described as a platform
  • 0:25
    that's built on Chrome's JavaScript runtime
  • 0:27
    for easily building fast, scalable network applications.
  • 0:30
    Node.js uses an event-driven, non-blocking I/O model
  • 0:34
    that makes it lightweight and efficient,
  • 0:36
    perfect for data-intensive real-time applications
  • 0:39
    that run across the distributed devices.
  • 0:41
    Well, that's a nice, succinct description, but what on earth does it all mean?
  • 0:45
    Well, Node.js runs on Google's V8 JavaScript engine,
  • 0:48
    which is a virtual machine.
  • 0:50
    It uses an event-driven, non-blocking input/output model,
  • 0:54
    which allows it to handle many thousands of connections on a single process.
  • 0:58
    Due to its asynchronous design,
  • 1:00
    Node.js is is really well suited for real-time communication;
  • 1:04
    things like chat and games.
  • 1:06
    NPM stands for Node Package Manager,
  • 1:08
    and it's used to manage packages for node.js applications.
  • 1:12
    Packages are basically dependencies.
  • 1:15
    You can think about them much like you would a Drupal module.
  • 1:17
    NPM comes bundled with Node.js,
  • 1:20
    so when you install Node.js you'll actually also have NPM installed.
  • 1:25
    Packages are defined by a package.json file
  • 1:28
    inside the package directory .
  • 1:31
    NPM itself allows you to download
  • 1:35
    and also publish packages for other people to use.
  • 1:38
    So let's do a quick comparison.
  • 1:40
    It's a little difficult to compare
  • 1:42
    Node.js and Drupal,
  • 1:44
    as one's a PHP framework
  • 1:47
    and the other is JavaScript running on the server;
  • 1:50
    however, let's give it a shot.
  • 1:52
    NPM was created in 2009
  • 1:56
    and to date has 171,722 packages
  • 2:02
    at the time of recording.
  • 2:04
    Drupal conversely has 31,440 modules,
  • 2:08
    and it was created in 2001.
  • 2:11
    So you can see Node and NPM indeed very popular,
  • 2:15
    and there's lots of activity there.
  • 2:18
    You can see that simply based on the statistics in this slide.
  • 2:21
    So what exactly is the Node.js Drupal module?
  • 2:24
    Well, it's actually made up of two distinct parts.
  • 2:27
    Firstly, a set of Drupal modules that allow for adding
  • 2:30
    real-time capabilities to a Drupal site,
  • 2:32
    and then it's also a Node.js application,
  • 2:35
    which is built with the node modules, express, and request,
  • 2:39
    available from NPM, and the Node.js application itself
  • 2:43
    is run from the terminal.
  • 2:45
    I'm at, and I've just searched for,
  • 2:50
    which is one of the dependencies for the Node project.
  • 2:53
    You'll see here is simply a Node.js real-time framework server.
  • 2:58
    It has a simple description on how to use it there.
  • 3:01
    Thankfully, you don't need to write any code.
  • 3:03
    It's already done for you in a Node.js integration module.
  • 3:07
    Just to show you the other dependencies,
  • 3:09
    there's also request, which again is a simplified HTTP client,
  • 3:14
    as you can see here on the NPM project page for it.
  • 3:17
    And then lastly, there's express,
  • 3:20
    which is a fast, unopinionated minimalist web framework,
  • 3:23
    as its description here in NPM states.
  • 3:25
    Those are the modules that make up
  • 3:28
    the Node.js applications dependencies.
  • 3:31
    And then obviously, the creators of the Drupal module itself
  • 3:35
    have written an application that's called Server.js,
  • 3:39
    and we'll get further into that later in the series.
  • 3:42
    But basically, at its core, the Node.js Drupal module
  • 3:45
    allows a Node.js application to talk to Drupal
  • 3:49
    and vice versa, and also for an end user to connect and talk to Drupal
  • 3:54
    both over the regular channels that are available with the Drupal set up,
  • 3:58
    as well as also using the library,
  • 4:02
    which is part of the Node.js integration module
  • 4:04
    to create a socket connection
  • 4:06
    to allow for persistent real-time communications.
  • 4:09
    For now, I'm going to head over to my Drupal site
  • 4:12
    and jump ahead of my second video in this series,
  • 4:16
    which actually covers installing Node.js,
  • 4:18
    NPM, and the Node.js Drupal integration module.
  • 4:21
    I'm just going to pop open my module's page
  • 4:25
    as an administrator so that I can quickly talk through
  • 4:29
    the various modules that are part of the Node.js integration module itself.
  • 4:33
    I'm going to minimize the core modules
  • 4:35
    and scroll down a little.
  • 4:37
    Here you can see, in the Node.js section,
  • 4:40
    these are all of the modules that are actually bundled with the main module.
  • 4:44
    The core module is Node.js integration itself,
  • 4:50
    which, as you can see, adds Node.js support to Drupal.
  • 4:52
    Node.js config is probably the most useful other module
  • 4:57
    along with core in that it helps you to set settings
  • 5:01
    for Drupal to store
  • 5:04
    and tell it which way it should talk to Node.js,
  • 5:07
    as well as providing a handy configuration builder
  • 5:10
    for you to create configurations for your Node.js application.
  • 5:15
    And then we have Node.js notifications,
  • 5:18
    which adds a client to pages for displaying
  • 5:20
    real-time notifications for Node.js.
  • 5:23
    Those three modules together
  • 5:26
    are what make up the core of the Node.js integration project.
  • 5:30
    The other modules are kind of additional,
  • 5:33
    and they can be used on their own with Node.js integration config
  • 5:37
    and the notifications module
  • 5:40
    to provide extra functionality.
  • 5:42
    Let's take Node.js Actions, for example.
  • 5:45
    It provides actions that dispatch
  • 5:47
    real-time user notifications via Node.js.
  • 5:50
    I'll be covering that in a video in this series called
  • 5:53
    Node.js Actions in Action.
  • 5:55
    In this series, I'm not going to be covering Node.js Buddy List.
  • 5:58
    It's a little out of scope of this series.
  • 6:00
    However, I am going to go on
  • 6:03
    and cover Node.js Notifications, which I've already mentioned,
  • 6:07
    Node.js Subscribe, which allows for subscription based notifications
  • 6:13
    for different content types.
  • 6:15
    I'm also going to cover Node.js Watchdog,
  • 6:17
    which adds watchdog messages to the DB log page in real time.
  • 6:22
    That's a real helpful one.
  • 6:25
    That requires the Node.js AJAX framework integration module,
  • 6:30
    which is also bundled with Node.js integration module.
  • 6:34
    So that's a quick overview
  • 6:37
    of the Node.js Drupal module itself.
  • 6:39
    Really, at the core of it,
  • 6:42
    it is a notification client
  • 6:44
    for a variety of things occurring on your Drupal site,
  • 6:48
    and it allows for a fully persistent connection
  • 6:51
    between users that are connected to your site and Drupal.
  • 6:55
    Let's do a little recap.
  • 6:57
    In this lesson, we covered what Node.js is.
  • 7:00
    We also learned about what NPM is,
  • 7:03
    Node's package manager.
  • 7:05
    And then we took a quick overview of the Node.js Drupal module
  • 7:08
    so that you could see
  • 7:10
    the modules that make up the Node.js integration module itself.
  • 7:15
    Thanks for watching.

What Is Node.js?


This series is about integrating Node.js with Drupal 7 using the Node.js Integration contributed module on The Node.js Integration project contains a number of submodules, and a separate Node.js application written in Javascript, that uses the Express,, and Request packages.

Node.js is really fantastic for real time communications, something that Drupal is not particularly good at, out-of-the-box. The Drupal Node.js Integration module brings a host of real time capabilities and a client for your site to enable notifications when a variety of events occur, so your users can receive overlay notifications directly in their browser without page reloads!

In this series we'll cover:

This series is a walk-through of how to get Node.js installed in your system, and how to install and configure the Node.js Drupal module, as well as a look at the related submodules. We'll install a different module that's dependent on the Node.js Drupal module. With this, you'll see how dependencies work in the context of the Node.js Drupal module's Node.js application's configuration.

Now, this series is not for the faint of heart. You'll need some Drupal administration knowledge, installing and configuring modules. We shall also be wildly typing things at the command line, so if you have some experience with command line use, that will definitely be helpful!

If you want to take your learning further, look for the self-check questions in the description for each tutorial in this series. These questions are presented to help you make sure you’re understanding the material, and to encourage you to explore how what you've just learned could apply to your own use case.

If you want to integrate Node.js and Drupal 7 so you can provide real time update notifications on your site, as well as a number of other real time communication options, this series is for you!