I had to do one extra step not mentioned in the documentation to get my node.js server working so I could reproduce the user login/logout notifications outlined in the example on the main module page.
After creating the symlink mentioned in step 1b:
1b. Optionally you can create a symlink:
cd /var/www/sites/all/modules/nodejs && ln -s /usr/local/lib/node/.npm/socket.io/active/package/ socket_io
I also had to make this symlink inside socket_io (this works if your document root is in /var/www, alter the path if your docroot is elsewhere)
cd /var/www/sites/all/modules/nodejs/socket_io && ln -s support/socket.io-client/
I'm rolling a patch to the README.txt now to include 1c. this perhaps optional extra step.
| Comment | File | Size | Author |
|---|---|---|---|
| #16 | README-1135626-4402360.patch | 2.86 KB | afeijo |
| #14 | readme.patch | 2.73 KB | afeijo |
| #8 | readme-1135626-4387876.patch | 1.03 KB | afeijo |
| #1 | socketiosetup-1135626.patch | 662 bytes | LSU_JBob |
Comments
Comment #1
LSU_JBob commentedHere's the patch
Comment #2
Anonymous (not verified) commentedthanks!
the way the socket.io directory and paths work is pretty sub-par - it really just grew out of me not doing it in a planned way, and i haven't fixed it yet. perhaps this issue is the place to fix it.
i think we should change the directory structure and any paths in code that require more than one symlink. so, we end up with instructions like: "1. download Socket.Io into the socket_io folder.", and it should all just work.
also, we should probably commit a directory called 'socket_io', and put a README.txt inside it.
are you ok to modify your patch along those lines?
Comment #3
LSU_JBob commentedSure.
I can make the extra directory in the project, Should we put the "optional" symlinks steps in this new socket_io/README.txt?
The two places in the code that I can see that maybe should be changed are in nodejs.module:
line 100
drupal_add_js(drupal_get_path('module', 'nodejs') . '/socket_io/support/socket.io-client/socket.io.js', array('type' => 'file'));line 386
Those are the only places that should change when the folder setup it figured out. Correct?
Speaking of the folder setup, Are you recommending we install socket_io in a non default directory? Or try and boil down the setup to making several symlinks in the new socket_io directory?
Comment #4
Anonymous (not verified) commentedok, updated the paths, added socket_io, added README.txt.
git pull and have a look, feel free to reopen if i broke something, or if you want better wording etc.
Comment #5
LSU_JBob commentedCan we change this step in the README.TXT:
> ln -s /path/to/socket/io/install/socket.io /path/to/your/nodejs/module/socket_io/
to
> ln -s /path/to/socket/io/install/socket.io socket.io
I created the symlink with the first command mentioned above and it made the symlink name "package" inside the socket_io directory you just created. This will cause the module to not find the socket javascript file because in line 100 of the module:
drupal_add_js(drupal_get_path('module', 'nodejs') . '/socket_io/socket.io/support/socket.io-client/socket.io.js', array('type' => 'file'));It's looking in socket_io/socket.io.
For my personal instance, the command was:
ln -s /usr/local/lib/node/.npm/socket.io/active/package/ socket.io
Just to ensure the name of the symlink was "socket.io" and not "package".
Comment #6
Anonymous (not verified) commentedah, yes, i'd forgotten about the way NPM uses symlinks.
i'd still like to keep the full path in the linkname part. thanks for the feedback, committed here:
http://drupalcode.org/project/nodejs.git/commit/33d6499
Comment #7
LSU_JBob commentedcool, I was going to suggest changing the path in the module on line 100 as an alternative, but this works just as well!
Comment #8
afeijoMy changes to the README.txt had the socket.io path like you used, LSU_JBob
But later I noticed that socket.io already has a symlink, so I changed it to:
/usr/local/lib/node/socket.io/
its shorter than
/usr/local/lib/node/.npm/socket.io/active/package/
:)
I attached the patch, I'll commit it after your review
Comment #9
LSU_JBob commentedI think this step should be changed to just, "Look in the socket_io directory and follow the README instructions there to symlink to your local socket.io path" ... something along those lines, Justin wrote some pretty clear symlinking directions in there.
Comment #10
LSU_JBob commentedComment #11
Anonymous (not verified) commentedyeah, i agree with LSU_JBob - afeijo, please change it to that, and if you can see any way to make the README.txt in socket_io better, go ahead and patch it.
Comment #12
afeijoGood point, I forgot the new README.txt in socket_io folder
I will change the primary README.txt, and move the socket and express installations instructions to socket_io\README.txt
ok folks?
Comment #13
LSU_JBob commentedSounds good, post the pizzatch and we will rizzeview
Comment #14
afeijohere it is, patch for both README.txt
Comment #15
LSU_JBob commentedWhy did you get rid of this step?
Comment #16
afeijoI meant to move it to the socket_io/README.txt
here is the right patch
Comment #17
Anonymous (not verified) commentedlooks good to me, thanks afeijo
Comment #18
Anonymous (not verified) commentedpreparing for a beta, so i've committed this here:
http://drupalcode.org/project/nodejs.git/commit/8480b2c
thanks afeijo!