Skip to content
Snippets Groups Projects
Commit 8c5bc640 authored by Jay Friendly's avatar Jay Friendly
Browse files

Issue #2947739 by Jaypan: Updating documentation on nodeJS integration

parent ce8c559f
No related branches found
No related tags found
No related merge requests found
......@@ -23,44 +23,58 @@ use of polling,by integration with Nodejs, which handles updates in realtime.
* No ajax polling means less work for the browser.
* No ajax polling means less work for the server.
* Message threads immediately show new messages
* In-page browser notifications when new messages are received (optional).
## Requirements
* [Private Message module](https://www.drupal.org/project/private_message)
* [Nodejs module](https://www.drupal.org/project/nodejs)
* [Node.js](https://nodejs.org/)
## Hooking into a notification (JavaScript)
## Installation
Add a listener for the `pm:threads:poll` on the `window` object as follows:
### 1. Install Node.js
```JavaScript
$(window).on('pm:threads:poll', function(event, data) {
// Add your functionality here.
});
```
Instructions on Node.js installation are not provided here, as they differ per
system, and instructions are outside the scope of this document. Please see
the [Node.js homepage](https://nodejs.org/en/) for more information.
## Installation
### 2. Install the module
Install the private_message_nodejs module as you would any Drupal module.
### 3. Install the nodeJS dependendencies
On the command line, navigate to [PRIVATE_MESSAGE_MODULE_ROOT]/modules/private_message_nodejs/nodejs and run the
following command:
`npm install`
### 4. Confirm the Nodejs server is working
On the command line, navigate to [PRIVATE_MESSAGE_MODULE_ROOT]/modules/private_message_nodejs/nodejs and run the
following command:
`node app.js`
### 1. Install the module
Note: Leave this open and running, as closing the server will stop it from
working.
Install the module as you would any Drupal module.
### 5. Enter the URL to the node.js server in the private message configuration
### 2. Set up the Nodejs module
In the web browser, navigate to /admin/config/private_message/config. Expand the
Private Message Nodejs settings section, and enter the URL to the node JS app.
It should be found at [your domain]:8080. Save.
See the documentation on the
[Nodejs module page](https://www.drupal.org/project/nodejs) for directions on
setting up Drupal to work with Nodejs.
### 6. Test
### 3. Confirm the Nodejs server is working
Open up the private message page and check that there has been some output in
the command line, indicating that connections have been made to the Nodejs
server.
Check the status reports page at `/admin/reports/status` and ensure that the
Nodejs server is running. If you do not get a positive result, refer to the
documentation for that module, and/or open a ticket in the Nodejs issue queue
(linked to in step 2 above).
## Authors
The Private Message Nodejs module was by [Jeremy Graham](http://jez.me), and
integrated into the Private Message module as a submodule by [Jaypan](https://www.drupal.org/u/jaypan).
The Private Message Nodejs module was first written by
[Jeremy Graham](http://jez.me), integrating with the Drupal Node.js module.
A custom implementation that does not depend on that module was then written
by [Jay Friendly](https://www.jaypan.com).
name: Private Message NodeJS
description: Utilize NodeJS for instant message notifications without polling.
name: Private Message Node.js
description: Utilizes Node.js for instant message notifications without polling.
type: module
core: '8.x'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment