The nodejs.config.js file must contain correct values for the nodejs integration module to function correctly.
Using the Nodejs integration module with Drupal running in a subdirectory
Many people experience difficulty when attempting to get the module configured correctly when they are running the Drupal instance in a subdirectory of the server e.g. http://mydomain.com/my-site-directory or http://localhost/testsite etc
To facilitate this, one line of the nodejs.config.js file must contain your subdirectory name. Do not be confused by other keys such as baseAuthPath; only messagePath needs the site directory prefix, as follows:
The line
messagePath: '/nodejs/message'
must be changed to something like:
messagePath: '/my-site-directory/nodejs/message'
or
messagePath: '/testsite/nodejs/message'
Naturally, the rest of the config must still be configured as usual.