Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
the io object in socket.io is undefined and drupal isnt loading socket.io into client page. i'm fairly sure that this will close two other issues i've raised reaching this point of understanding.
is this module still being actively maintained, fixed and improved?
thanks
Comment | File | Size | Author |
---|---|---|---|
#8 | img4.png | 63.9 KB | zenimagine |
#8 | img3.png | 27.02 KB | zenimagine |
#8 | img2.png | 8.2 KB | zenimagine |
#8 | img1.png | 61.64 KB | zenimagine |
Comments
Comment #2
Syntapse CreditAttribution: Syntapse commentedComment #3
Syntapse CreditAttribution: Syntapse commentedi've managed to get this running by putting socket.io.js in my server / folder, but i dont think that its clear from documentation, and there still appear to be a lot old threads and discussions relating to this problem with no clear resolution.
is my server now working with correct setup or did i get lucky? not clear from online documentation. what is the correct location for socket.io.js and how does it relate to nodejs.config.js entry for resource?
is module still being maintained? i hope so as im two weeks into testing (slow process just getting it all working).
thanks
Comment #4
pribeh CreditAttribution: pribeh commentedHi @laurencefass, did you manage to get this resolved? Where did you put socket.io.js?
I'm having issues accessing socket.io. On a setup of mine I can't access socket.io, :8080 and config/nodejs/js gives me a 404. The reports/status page says Drupal can reach node.js and gives no debug information despite debug being turned on. I can also see in the terminal that the service key handshake seems to happen fine. I'm running node v8.1.4 and socket.io 1.7.4. The current path for socket.io is /home/username/node_modules/socket.io/socket.io.js.
Also, if I try to ping localhost:8080 with wscat I get a socket hang up.
Here's my config:
settings = {
scheme: 'http',
port: 8080,
host: '',
resource: '/socket.io',
serviceKey: 'secret',
publishUrl:'publish',
backend: {
port: 80,
host: 'www.domain.com',
scheme: 'http',
basePath: '',
messagePath: '/nodejs/message'
},
debug: true,
sslKeyPath: '',
sslCertPath: '',
sslCAPath: '',
baseAuthPath: '/nodejs/',
extensions: [],
clientsCanWriteToChannels: false,
clientsCanWriteToClients: false,
transports: ['websocket','polling','flashsocket','htmlfile','xhr-polling','jsonp-polling'],
jsMinification: true,
jsEtag: true,
logLevel: 1
};
Comment #5
pribeh CreditAttribution: pribeh commentedI got this working by ensuring I had a proper package.json file setup in my home/user folder. For some reason using linuxbrew to install node.js and NPM it didn't setup a base package file. That's why I couldn't ping the socket locally. Also, since the site is using Fastly (Varnish CDN) I had to switch over to using an IP instead of domain for the backend host. Fastly only permits communication through the :80 port so for the client to ping socket.io on the server I had to use ip:8081 to get it going. I get a 404 on the node config builder page still but I'm looking into that.
Comment #6
zenimagine CreditAttribution: zenimagine commentedSame problem for me, the module looks dead
Comment #7
Syntapse CreditAttribution: Syntapse commentedis the module still being maintained? is there a roadmap for node js module moving forward?
Comment #8
zenimagine CreditAttribution: zenimagine commentedI installed on my nodejs server but could not make it work. The instructions are really not clear and the module is full of bugs.
I think that my configuration is correct. But the site returns a page not found.
the directory
node_modules
is in/public_html
and my site Drupal 8 is in/public_html/web
Here is the configuration of the file nodejs.config.js (Drupal 8)
img1
img2
img3
img4
Comment #9
Syntapse CreditAttribution: Syntapse commentedi've had mixed results with and have no idea about load testing. if this module isn't being maintained it could serve as the basis for a new pub/sub "drupal push" module of some description. pushable fields, pushable flags, pushable entities.
that said would be great to hear from the maintainers.
thanks
Comment #10
zenimagine CreditAttribution: zenimagine commented@laurencefass Have you managed to operate this module?
Comment #11
Syntapse CreditAttribution: Syntapse commentedyes several times. its a bit delicate getting the settings exactly write, but once working, adding server push to pretty much anything is no big deal.
Comment #12
zenimagine CreditAttribution: zenimagine commenteddelete
Comment #13
Syntapse CreditAttribution: Syntapse commentedIts recommended to install outside drupal but it doesnt matter where it is as its access through URL::port. install it where you like. if its outside logically its easier to maintain each independently. also set node server debug to true for very useful trace.
Comment #14
zenimagine CreditAttribution: zenimagine commenteddelete
Comment #15
zenimagine CreditAttribution: zenimagine commenteddelete
Comment #16
Syntapse CreditAttribution: Syntapse commented...there is no socket.io.js in the directory?
Comment #17
zenimagine CreditAttribution: zenimagine commentedNo ...
I used the following command:
npm install drupal-node.js
According to the instructions, there is nothing else to download.
Comment #18
zenimagine CreditAttribution: zenimagine commented@laurencefass Do you have a file "socket.io.js" ? what does your repetoire look like ?
Comment #19
Syntapse CreditAttribution: Syntapse commentedthat sounds wrong. i have a frozen server in my archive i will dig it out, test it, and check for socket.io.js.
this looks interesting...
https://github.com/wodby/drupal-node
Comment #20
zenimagine CreditAttribution: zenimagine commented@laurencefass
Can you show me the contents of your socket.io folder please.
Are you known apache or nginx?
In http or https?
Comment #21
Syntapse CreditAttribution: Syntapse commentedthis is taken from a working installation...
@virtualmin:~/public_html/drupal-nodejs/node_modules/socket.io$ tree
.
@virtualmin:~/public_html/drupal-nodejs$ cat nodejs.config.js
and here is some proof (hope) that it actually brokers messages...
@virtualmin:~/public_html/drupal-nodejs$ node app.js
Comment #22
zenimagine CreditAttribution: zenimagine commentedOK, thanks. So it works for you and you do not have a "socket.io.js" file.
I have the right configuration. I really do not understand why it does not work.
Are you on "Apache 2"?
I saw on several discussion that it was necessary to use a port higher than 1024. Do you add a poxy to your virtualhost?
My site is in https.
Thank you in advance.
Comment #23
zenimagine CreditAttribution: zenimagine commentedHere is the configuration of my server :
My site is in :
/public_html/web/
I installed NodeJS on my server with the following command :
And on Drupal 8 with the following command :
Here is the NodeJS configuration for Drupal :
And :
I added to iptables :
Here is the contents of my /etc/hosts
Here is the contents of my /etc/apache2/ports.conf
Result of the command netstat -ntpl
On my site the following error is displayed in the console :
And : In the terminal I have : Here is my site : deleteComment #24
Syntapse CreditAttribution: Syntapse commentedi am running from apache 2, no proxy.
i have a socket.io directory with files installed. no reference to socket.io.js
https://www.drupal.org/project/nodejs/issues/2877036#comment-12527700
the source code for socket.io is:
├── lib
│ ├── client.js
│ ├── index.js
│ ├── namespace.js
│ └── socket.js
is your reference to socket.io.js correct?
Comment #25
zenimagine CreditAttribution: zenimagine commentedYes I have exactly the same files as you. Can you tell me if there is a problem with my setup #23 ?
Comment #26
zenimagine CreditAttribution: zenimagine commentedI updated #23
Comment #27
zenimagine CreditAttribution: zenimagine commented@laurencefass
How did you configure your 7004 port ?
I think the problem comes from the configuration of my server.
Comment #28
kuzguni CreditAttribution: kuzguni commentedI've got a different type of socket.io error. to cut short: node.js reports:
checkServiceKey: Invalid service key undefined
and here are my details:
i am using opigno_lms (2.1) based drupal 8.x
i've got my drupal domain on akademi.piyononline.com and nodejs on node.akademionline.com.
nginx proxies my node.js on 8765 to both 8443 and 443.
started the node.js server with these settings (i am using letsencrypt, so the paths are set).
"scheme":"https",
"host":"node.piyononline.com",
"port":8765,
"backend":{
"port":443,
"scheme": 'https',
"strictSSL": true,
"host":"node.piyononline.com",
"messagePath":"nodejs/message"
}
"baseAuthPath":"/nodejs/",
"publishUrl":"publish",
Drupal settings:
admin/config/private_message/config
URL: https://node.piyonakademi.com:443
key: set to node.js config setting.
drupal->node.js
admin/config/nodejs/settings
https
node.piyononline.com
8765
service key also set to node.js setting
Client->node.js
https
node.piyononline.com
8443
This is what happens on console:
The socket.io scripts loads fine, I also check it with https://node.piyononline.com:8443/socket.io/socket.io.js
Next, the server reports error on
https://node.piyononline.com:8443/socket.io/?EIO=3&transport=websocket&s...
with 400 Bad Request.
when I investigate it, the server responds blank and on the server, i see
checkServiceKey: Invalid service key undefined, expecting [THEKEY], so somewhere the key wont get forwarded back to server.
i of course checked, if the secondary socket.io link works on a different tab, and it responds with a JSON containing Session ID unknown. that is fine, as another tab means no session there. but i'ev got a good working response.
On the browsers (I checked firefox, chrome and safari, so the error shouldnt be coupled to firefox), the chatbox headermast appers, but when i click on it to reveal the channels, there is no channel at all. i of course have another user open at the same time, so there should be users.
Is there anything I've not seen that someone can point out?
Comment #29
imclean CreditAttribution: imclean commented@zenimage: For a description of the NodeJS server config options, see my comment here.
I think using "localhost" could be part of the problem. What is "localhost" in the context of the website and the machine your browser is running on? Both of them need to access the NodeJS server.
Try assigning an IP address (and hostname if you like) to the NodeJS server and accessing it via that. It can't run on the same hostname/IP address and port combination as the web server.
Make sure you update the NodeJS config in Drupal as well when you make the changes.
Comment #30
grincon CreditAttribution: grincon as a volunteer commentedI'm putting this out here for anyone having trouble with the HTTPS implementation of nodejs in Drupal 7. Both "scheme" values in my config were https, as well as my config in the nodejs config page. When using HTTP it was all working fine.
When using HTTPS I kept getting "Error reaching the Node.js server at "nodejs/health/check": [0] Error opening socket ssl://example.com:8088" in my logged messages and the status page kept showing "Error reaching the Node.js server. Make sure your Node.js service key matches the key set in the server application."
I found that this was an issue on how drupal_http_request works and a limitation it has on certificate validation. I found this "miracle" module that replaces the drupal_http_request function with a cURL enabled one and it all started working.
The module can be found here: CHR. Once installed and enabled, go to the config page admin/config/services/chr and turn on "Override Drupal HTTP Request".
Hopefully this helps you out there.