Download the PHP package zvse/private_message_messenger_nodejs without Composer
On this page you can find all versions of the php package zvse/private_message_messenger_nodejs. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download zvse/private_message_messenger_nodejs
More information about zvse/private_message_messenger_nodejs
Files in zvse/private_message_messenger_nodejs
Package private_message_messenger_nodejs
Short Description Instant updates for private messages without polling
License GPL-2.0+
Homepage https://github.com/jez500/Private-Message-NodeJS
Informations about the package private_message_messenger_nodejs
Fork info
Pure fork of the https://github.com/jez500/Private-Message-NodeJS with the package name change
Private Message NodeJS
Instant updates and notifications for the Private Message Messenger module module without the need for polling.
This listens for private message thread updates and uses the drupal nodejs module to trigger updates to the UI and provide notifications for members of the changed thread.
NOTE: This is different to the Private message nodejs module.
This module was written to be paired with Private Message Messenger
and and they both work well together.
How it normally works
Polling is the standard method of checking for message updates, this means a website will hit your server every XX seconds to see if anything has changed. This is not ideal as it puts lots of extra load on your server with all those requests, it also means a user will have to wait XX seconds for a reply. If polling is disabled, it would require a full page reload!
Why this is a huge improvement
- No polling slowing down your browser
- No unnecessary constant load on your server
- Message threads immediately show new messages
- In-page browser notifications when new messages are recieved (optional).
Requirements
Not a requirement, but this module has been specifically made to work with Private Message Messenger, if you are not using this, you will have to implement your own integration (see below for hooking into a notification).
Hooking into a notification
This module triggers an event on $(window)
so all you have to do is listen to window for the event. Eg:
Installation
Just type
composer require zvse/private_message_nodejs
And...
drush en -y private_message_nodejs
2. Ensure you have NodeJS setup and working
See basic guide here. Steps I took at time of writing:
- Install NodeJS
v4.2.6
on your server npm install drupal-node.js
should be outside ofdocroot
and will default tonode_modules
foldercd node_modules/drupal-node.js
andcp nodejs.config.js.example nodejs.config.js
- Edit
nodejs.config.js
with your config, at a bare minimum setserviceKey
to a random value, I also had to update thebackend.host
with the correct url for my drupal site - Start the server
node app.js
also look at using forever - In your drupal site, go to
/admin/config/nodejs/settings
and add theserviceKey
you created above. Other settings should match yournodejs.config.js
file (only thing I need to change was the host) - The status report page
/admin/reports/status
should indicate drupal has found the NodeJS server
NOTE 1: At time of writing this, the "stable" release of drupal/nodejs
(v1.1
) was actually quite broken, the
1.x-dev
version is far more robust.
NOTE 2: For https support with drupal/nodejs
you will likely need this patch.
3. Notifications - Optional, but handy for testing
Enable the nodejs_notify
module, open a few browser windows and go to /admin/config/nodejs/broadcast
in one of them
to send a message to all the others. If that works, this module should be ready to go!
The nodejs_notify
module also provides jGrowl which is used for notifications in
this module. If you don't want nodejs_notify
enabled but still want notifications then include
jGrowl manually
4. Disable polling
You don't need it anymore, set the Ajax refresh rate
for messenger blocks and config to 0
so it wont poll anymore.
5. Test
If you are using Private Message Messenger, Open 2 different browsers, each logged in as different users, send a message from one user to another, you should see threads and blocks instantly update and a notification displayed.
Author
This module is created by Jeremy Graham but wouldn't be possible without all the great work done by Jaypan on the Private Message module