I was getting "Unexpected token ILLEGAL" so I added output of the 'chunk' variable on server.js line 289, and it's borking on an HTML 404 page. (Each line comes through as a chunk and fails to parse as JSON.)
I'm not that familiar yet with node.js or with websockets, but presumably I have something configured wrong. I seem to have the server running on 8080, but how do I debug the pages the websocket is trying to reach?
More generally, what are the modules in the package supposed to do when they're all turned on and the node.js server is running?
(I'm at DrupalCon now, I attended both node.js BoFs, so if one of the maintainers could spare a few minutes, it would be awesome)
Thanks
Comments
Comment #1
thebuckst0p commentedI think I found the problem, my site was running on a subdirectory but my paths in nodejs.config.js were relative to the root.
Would it be possible to put some more detailed documentation in the README on how to use the config file?
Thanks for the great work on this!
Comment #2
arithmetric commentedI've added more details to nodejs.config.js.example for how the configuration options are used. At this point, this change is in the git repository only.
Comment #3
tuongaz commentedI stil got this error. Below is my nodejs.config.js:
Any suggestions?
My Drupal site is: http://dev.drupal7
Comment #4
arithmetric commentedTry setting the first "host" under drupalSettings to an empty string ('').
If you have host set to 127.0.0.1, then the node server will only listen for connections from clients to that IP address. Unless clients are coming from the same system (localhost), then they'll be using a different IP address (i.e. 192.168.0.60 on your private LAN).
Also, for the "host" value under backend: If you're using "localhost", then make sure that your Drupal site responds to this host name (rather than another name, like dev.drupal7 as you mentioned).
Comment #5
tuongaz commentedThanks
Just did as you suggested but still got the following error:
and here's the config file as per ur suggestion:
Comment #6
Anonymous (not verified) commentedwhat that log message says:
1. the drupal webpage was loaded successfully in the browser
2. the socket.io js ran, and successfully opened a connection to node.js
3. node.js then tried to authenticate the client via drupal, and got something back that wasn't valid JSON
the request from node.js ---> drupal uses backend.host to set the host for the http auth request.
using '' for the host won't work, it needs to be set to the hostname the drupal site runs as, and the node.js process needs to be able to resolve that hostname.
Comment #7
arithmetric commentedYes, I was only suggesting to leave the first host parameter empty. The second host parameter needs to be the host that the node.js server process uses to contact the Drupal site.
The fact that a client connected is a good sign.
I'd suggest something like:
Comment #8
ifuyivara commentedI'm getting the same error. My drupal instalation is in a directory on localhost. (localhost/drupal)
My settings:
Are those settings correct?
Comment #9
afeijono, your authPath should be /drupal/nodejs/auth/
Comment #10
tuongaz commentedThanks guys.
I installed a fresh D7 + Nodejs and now all working well.
Comment #11
logii commentedI'm so near but yet so far..
I installed socket.io with NPM and also downloaded from https://github.com/learnboost/socket.io-node
Renamed the folder to socket_io and uploaded to /sites/all/modules/nodejs/socket_io
After running $ node server.js , I get the error below
My nodejs.config.js
Is there anything wrong with my config file?
ps: Thanks for integrating node.js as API in Drupal. Now Drupal development has become sexy!
Cheers,
Logi
Comment #12
logii commentedComment #13
afeijothe authPath is not relative to your linux structure, but to your websocket in port 8080
In another issue it has been mentioned that if you have your drupal in a folder instead the www root, you need to add the folder name to authPath, try it:
'authPath': '/foldername/nodejs/auth/'
Comment #14
arithmetric commentedAlso, the port under "backend" should not be the same as the first port. The "backend" port refers to the HTTP port that your Drupal site is running on, which is usually 80.
Comment #15
logii commentedI'm not sure of which is the actual WWW root, because I'm using a subdomain sitting outside of "public_html" of the main doamin.
the File structure Cpanel usually recommend is:
[public_html]
- [subdomain1]
- [subdomain2:nodejs]
- [subdomain3]
But my current subdomains where created along side with public_html instead:
[public_html]
[subdomain1]
[subdomain2:nodejs]
[subdomain3]
With my current situation, I'm assuming that my webroot should be: '/nodejs/auth/'?
I'm continually trying to get this to work right now and will post updates once I got this working.
Meanwhile, any help is appreciated.
Comment #16
logii commentedafeijo, You were right. Thanks!
By adding that folder, now it works.
However it was relative to my home directory '~/'
Just like what I posted above.
Comment #17
Anonymous (not verified) commentedComment #19
jeff h commentedJust a note for anyone else experiencing similar issues; in my case at least I had to restart the node.js server before any changes to the authPath (in nodejs.config.js) took effect.
Comment #20
rootrau commentedhelp me fix error
Backend authentication url not found, full response info: { socket:
{ bufferSize: 0,
fd: null,
type: 'tcp4',
allowHalfOpen: false,
_writeImpl: [Function],
_readImpl: [Function],
_shutdownImpl: [Function],
_readWatcher: null,
destroyed: true,
readable: false,
_writeQueue: [],
_writeQueueEncoding: [],
_writeQueueFD: [],
_writeQueueCallbacks: [],
_writeWatcher: null,
writable: false,
_connecting: false,
_events:
{ connect: [Function],
error: [Function],
close: [Function] },
_httpConnecting: false,
_httpMessage: null,
ondrain: [Function],
ondata: [Function],
onend: [Function],
_idleNext: null,
_idlePrev: null },
connection:
{ bufferSize: 0,
fd: null,
type: 'tcp4',
allowHalfOpen: false,
_writeImpl: [Function],
_readImpl: [Function],
_shutdownImpl: [Function],
_readWatcher: null,
destroyed: true,
readable: false,
_writeQueue: [],
_writeQueueEncoding: [],
_writeQueueFD: [],
_writeQueueCallbacks: [],
_writeWatcher: null,
writable: false,
_connecting: false,
_events:
{ connect: [Function],
error: [Function],
close: [Function] },
_httpConnecting: false,
_httpMessage: null,
ondrain: [Function],
ondata: [Function],
onend: [Function],
_idleNext: null,
_idlePrev: null },
httpVersion: '1.1',
complete: true,
headers:
{ date: 'Mon, 26 Sep 2011 08:49:14 GMT',
server: 'Apache/2.2.15 (CentOS)',
'content-length': '401',
connection: 'close',
'content-type': 'text/html; charset=iso-8859-1' },
trailers: {},
readable: false,
url: '',
method: null,
statusCode: 404,
client:
{ bufferSize: 0,
fd: null,
type: 'tcp4',
allowHalfOpen: false,
_writeImpl: [Function],
_readImpl: [Function],
_shutdownImpl: [Function],
_readWatcher: null,
destroyed: true,
readable: false,
_writeQueue: [],
_writeQueueEncoding: [],
_writeQueueFD: [],
_writeQueueCallbacks: [],
_writeWatcher: null,
writable: false,
_connecting: false,
_events:
{ connect: [Function],
error: [Function],
close: [Function] },
_httpConnecting: false,
_httpMessage: null,
ondrain: [Function],
ondata: [Function],
onend: [Function],
_idleNext: null,
_idlePrev: null },
httpVersionMajor: 1,
httpVersionMinor: 1,
upgrade: false,
_events: { end: [ [Function], [Function] ], data: [Function] },
_decoder:
{ encoding: 'utf8',
charBuffer: ,
charReceived: 0,
charLength: 0 } }
nodejs beta6
Comment #21
neovinhtru commentedHi everybody!
can you help me? i was using nodejs and drupal chat, i did run node server.js but drupalchat not working.
i was getting messages this.
--------------
[root@mail nodejs]# node server.js
Started http server.
info - socket.io started
Failed to parse authentication message: [SyntaxError: Unexpected token <]
Failed to parse authentication message: [SyntaxError: Unexpected token <]
Failed to parse authentication message: [SyntaxError: Unexpected token <]
Failed to parse authentication message: [SyntaxError: Unexpected token <]
Failed to parse authentication message: [SyntaxError: Unexpected token <]
----------------
Thanks!
Comment #22
deoashish commentedI getting similar issue.Please tell me way to resolve it
Comment #23
sunset_bill commentedI was getting this, too, on a new install. What fixed it for me was enabling Clean URLs.