I think I've setup everything OK. At least when I run node server.js then send broadcast notification messages from the site, the output from server.js is:

Started http server.
   info  - socket.io started
publishMessage: message { broadcast: true,
  data: { subject: 'test', body: 'test sfsdf sdfasdfsdfsdf' },
  channel: 'nodejs_notify',
  clientSocketId: '' }
Broadcasting message

However, when I try to post a chat I just get a bunch of callback: 'chatroomUserOnlineHandler' log entries but no chat message content e.g.:

setContentToken: message { token: 'CNxJkzXZqA5wfnI-F6InSBnzMYqet-KD5ULwgYp0vto',
  channel: 'chatroom_1',
  notifyOnDisconnect: true }
setContentToken CNxJkzXZqA5wfnI-F6InSBnzMYqet-KD5ULwgYp0vto for channel chatroom_1
publishMessageToContentChannel: message { channel: 'chatroom_1',
  callback: 'chatroomUserOnlineHandler',
  data: { cid: '1', uid: '1', name: 'enadmin' },
  clientSocketId: '' }
setContentToken: message { token: 'OHisStHnGUpZVIzYNJpF0WbB4A_0cz8sR7R4gQRFLE4',
  channel: 'chatroom_1',
  notifyOnDisconnect: true }
setContentToken OHisStHnGUpZVIzYNJpF0WbB4A_0cz8sR7R4gQRFLE4 for channel chatroom_1
publishMessageToContentChannel: message { channel: 'chatroom_1',
  callback: 'chatroomUserOnlineHandler',
  data: { cid: '1', uid: '1', name: 'enadmin' },
  clientSocketId: '' }
setContentToken: message { token: 'DaOMJUJdgOBqGI3FWwU1uB5EmFUFRnn8RP6WkivigkY',
  channel: 'chatroom_1',
  notifyOnDisconnect: true }
setContentToken DaOMJUJdgOBqGI3FWwU1uB5EmFUFRnn8RP6WkivigkY for channel chatroom_1
publishMessageToContentChannel: message { channel: 'chatroom_1',
  callback: 'chatroomUserOnlineHandler',
  data: { cid: '1', uid: '1', name: 'enadmin' },
  clientSocketId: '' }

Comments

inteja’s picture

Anyone got any ideas about this ... I'm lost

aakkawi’s picture

having exactly the same problems,, seems to be broken ...

inteja’s picture

Hi aakkawi, I was eventually able to resolve this by ensuring port 8080 was open on my server. See my comment in the nodejs integration module issues queue: #2079867-4: Nodejs tests OK but neither DrupalChat nor Chat room modules work

aakkawi’s picture

ah cool. ya it is closed at my server.. now i have to ask,, how did you open it ? ^^. I added a rule to my Plesk firewall for 8080 and tried alsom this http://www.centos.org/docs/4/4.5/Security_Guide/s1-firewall-ipt-basic.html to edit in my Centos.. I restarted then, but it is still says it is closed .

inteja’s picture

My Linux server admin skills are rudimentary. That particular site I needed chat for was on a fully managed server, so I just left it to the experts :-)

wmfinck’s picture

I am beating myself over the head with this issue all morning. I have the Chat Room set up, but never see any messages.

Nodejs must be working, because it sees everything I type not only into the Nodejs broadcast admin page, but also into the chat widget supplied by the Chat Room module. Here is some of the ssh terminal debug output:

setContentToken qy9hq_xWXPoxb0jnepPUBJ5Bvd4xfhGIWeLR_aOjKnU for channel chatroom_2
publishMessageToContentChannel: message { channel: 'chatroom_2',
callback: 'chatroomUserOnlineHandler',
data: { cid: '2', uid: '1', name: 'William' },
clientSocketId: '' }
setContentToken: message { token: 'vn4E0Xe_MJlrsf6myrlJMHpZ-HUYEV7WC2KE1nzIqUk',
channel: 'chatroom_2',
notifyOnDisconnect: true }
setContentToken vn4E0Xe_MJlrsf6myrlJMHpZ-HUYEV7WC2KE1nzIqUk for channel chatroom_2
publishMessageToContentChannel: message { channel: 'chatroom_2',
callback: 'chatroomUserOnlineHandler',
data: { cid: '2', uid: 0, name: 'Anonymous' },
clientSocketId: '' }
setContentToken: message { token: 'bsBVwIvlZ1zn9KiM2LlzXrmerQ-LF-W7zASnCuk6k3w',
channel: 'chatroom_2',
notifyOnDisconnect: true }
setContentToken bsBVwIvlZ1zn9KiM2LlzXrmerQ-LF-W7zASnCuk6k3w for channel chatroom_2
publishMessageToContentChannel: message { channel: 'chatroom_2',
callback: 'chatroomUserOnlineHandler',
data: { cid: '2', uid: 0, name: 'Anonymous' },
clientSocketId: '' }
setContentToken: message { token: 'UvKrdgpYlx6Jfvxn30EVa4qiHheS7dVyvMEmwKNFn58',
channel: 'chatroom_2',
notifyOnDisconnect: true }
setContentToken UvKrdgpYlx6Jfvxn30EVa4qiHheS7dVyvMEmwKNFn58 for channel chatroom_2
publishMessageToContentChannel: message { channel: 'chatroom_2',
callback: 'chatroomUserOnlineHandler',
data: { cid: '2', uid: 0, name: 'Anonymous' },
clientSocketId: '' }
setContentToken: message { token: 'XaqcplGGZ9OtDCbez7jtRvcVT9Sl0KCvlY-C3QbwsJw',
channel: 'chatroom_2',
notifyOnDisconnect: true }
setContentToken XaqcplGGZ9OtDCbez7jtRvcVT9Sl0KCvlY-C3QbwsJw for channel chatroom_2
publishMessageToContentChannel: message { channel: 'chatroom_2',
callback: 'chatroomUserOnlineHandler',
data: { cid: '2', uid: 0, name: 'Anonymous' },
clientSocketId: '' }
setContentToken: message { token: 'ApLyITkzRDCQfi8gdvDbP8Eg_C5K18jKkNx3RJvUK1c',
channel: 'chatroom_2',
notifyOnDisconnect: true }
setContentToken ApLyITkzRDCQfi8gdvDbP8Eg_C5K18jKkNx3RJvUK1c for channel chatroom_2
publishMessageToContentChannel: message { channel: 'chatroom_2',
callback: 'chatroomUserOnlineHandler',
data: { cid: '2', uid: 0, name: 'Anonymous' },
clientSocketId: '' }
publishMessage: message { broadcast: true,
data:
{ subject: 'This is a test',
body: 'This is a test broadcast from admin/config/nodejs/nodejs_notify/broadcast' },
channel: 'nodejs_notify',
clientSocketId: '' }
Broadcasting message

This is not a firewall issue. Here is what I get from netstat:

[root@phoenix ~]# netstat -an | grep 80 | grep -i listen
tcp 0 0 127.0.0.1:8080 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:8880 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:8000 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:8001 0.0.0.0:* LISTEN
tcp 0 0 :::80 :::* LISTEN
tcp 0 0 :::8880 :::* LISTEN

Any pointers as to what may be missing would be appreciated. The configuration in nodejs.config.js is the exact default configuration that comes when one first runs the Node.js server configuration builder.

Thanks in advance

wmfinck’s picture

Since the last post I made, I have activated the dblog module, and the ajax module is activated. Every log entry is now being written to the console, but are only seen in the log report when I refresh.

It seems that Drupal is communicating fine with nodejs but nodejs is not communicating with Drupal. There must be a setting that is wqrong, and I have played with it for hours. Here is my config file:

/**
* This configuration file was built using the 'Node.js server configuration builder'.
* For a more fully commented example see the file nodejs.config.js.example in the root of this module
*/
backendSettings = {
"scheme":"http",
"host":"localhost",
"port":8080,
"key":"/path/to/key/file",
"cert":"/path/to/cert/file",
"resource":"/socket.io",
"publishUrl":"publish",
"serviceKey":"my_key_goes_here",
"backend":{
"port":80,
"host":"localhost",
"messagePath":"/nodejs/message"},
"clientsCanWriteToChannels":false,
"clientsCanWriteToClients":false,
"extensions":"",
"debug":true,
"transports":["websocket",
"flashsocket",
"htmlfile",
"xhr-polling",
"jsonp-polling"],
"jsMinification":true,
"jsEtag":true,
"logLevel":1};

Any help is appreciated!

wmfinck’s picture

Today I changed all occurrences of "localhost" to "0.0.0.0" in the config file and in the Drupal nodejs config pages, however this still does not work. I still do not see any nodejs messages in the Chat Room or in dblog.

When I try pointing my browser to any of the imagined "publish" URLs, I get 404 redirects, and here are the dblog entries:

page not found 01/22/2014 - 09:36 publish [username]
page not found 01/22/2014 - 09:36 publish [username]
page not found 01/22/2014 - 09:36 nodejs/publish [username]
page not found 01/22/2014 - 09:35 nodejs/publish [username]

When I point my browser to either http://example.com/nodejs/message/ or .../message, I do get this, which is okay: {"error":"Invalid service key."}

The nodejs server is getting all of my messages, and all of my dblog entries, and printing them to the console.

But Drupal is not "hearing" anything from nodejs in return.

However if I purposely change my nodejs settings to something which does not work, I get a message in dblog which says something like "error connecting to nodejs server"!
Wow, that is frustrating.

wmfinck’s picture

After a couple of weeks of banging my head against the wall, I seem to have fixed this by putting my website's IP into the backend configuration, and the appropriate places in the nodejs config.

ChrisZZ’s picture

I am still fighting with the problem, you described. Everything ends up at the nodes server - which is nicely documented through the command line debugging mode. But somehow it is not coming back to drupal. At least not at the right time. It says, that it could not find nodes/message - but if I open the URL, this works fine.

E.g. in Chatroom, I send a chat messgae - it appears on the command line. It does not come up live - but it comes, once I reload the browser....

any smart ideas? Thanks a lot in advance!

backendSettings = {
  "scheme":"http",
  "host":"",
  "port":8080,
  "resource":"/socket.io",
  "publishUrl":"publish",
  "serviceKey":"XXXXXXX",
  "backend":{
  "port":80,
  "host":"URL",
  "messagePath":"nodejs/message"},
  "extensions":"",
  "debug":true,
  "transports":["websocket",
  "flashsocket",
  "htmlfile",
  "xhr-polling",
  "jsonp-polling"],
  "jsMinification":true,
  "jsEtag":true,
  "logLevel":1};
drein’s picture

I have the same problem, but perhaps something is broken from this log. this is what happen when I try to write a message chat with chatroom.
Started http server.
info - socket.io started
setContentToken: message { token: 'YI7Wf_LilVNUb8uvzdR7vePDTjngnMvTMyCBRqhx3g8',
channel: 'chatroom_1',
notifyOnDisconnect: true }
setContentToken YI7Wf_LilVNUb8uvzdR7vePDTjngnMvTMyCBRqhx3g8 for channel chatroom
_1
publishMessageToContentChannel: message { channel: 'chatroom_1',
callback: 'chatroomUserOnlineHandler',
data: { cid: '1', uid: '1', name: 'admiin' },
clientSocketId: '' }
setContentToken: message { token: 'VuFZb0e2euZb3bep--kFlEgCO3J-kD4g_foxbllAffY',
channel: 'chatroom_1',
notifyOnDisconnect: true }
setContentToken VuFZb0e2euZb3bep--kFlEgCO3J-kD4g_foxbllAffY for channel chatroom
_1
publishMessageToContentChannel: message { channel: 'chatroom_1',
callback: 'chatroomUserOnlineHandler',
data: { cid: '1', uid: '1', name: 'admiin' },
clientSocketId: '' }
getContentTokensUsers: [TypeError: Cannot read property 'sockets' of undefined]
getContentTokensUsers: [TypeError: Cannot read property 'sockets' of undefined]

dapseen’s picture

#10 have you been able to resolve the issue? i have the same problem

sukhjeet81’s picture

Every thing Goes fine in Installation of Node Js And Socket.io
In Cmd Line "node server.js" i run It displays

"Started http server.
info - socket.io started"

But When I go The Admin Panel And Try to Sent6 Broadcast Message It Doesnot Display At Next End

And In CMD It Shows

readable: true,
domain: null,
_events:
{ end: [Object],
finish: [Function: onSocketFinish],
_socketEnd: [Function: onSocketEnd],
free: [Function],
close: [Object],
agentRemove: [Function],
drain: [Function: ondrain],
error: [Object],
connect: undefined },
_maxListeners: 10,
_writableState:
{ highWaterMark: 16384,
objectMode: false,
needDrain: false,
ending: false,
ended: false,
finished: false,
decodeStrings: false,
length: 0,
writing: false,
sync: false,
bufferProcessing: false,
onwrite: [Function],
writecb: null,
writelen: 0,
buffer: [] },
writable: true,
allowHalfOpen: false,
onend: null,
destroyed: false,
errorEmitted: false,
bytesRead: 1480,
_bytesDispatched: 320,
_pendingData: null,
_pendingEncoding: '',
parser: null,
_httpMessage:
{ domain: null,
_events: [Object],
_maxListeners: 10,
output: [],
outputEncodings: [],
writable: true,
_last: false,
chunkedEncoding: false,
shouldKeepAlive: true,
useChunkedEncodingByDefault: true,
sendDate: false,
_hasBody: true,
_trailer: '',
finished: true,
_hangupClose: false,
socket: [Circular],
connection: [Circular],
agent: [Object],
socketPath: undefined,
method: 'POST',
path: '/nodejs/message',
_headers: [Object],
_headerNames: [Object],
_header: 'POST /nodejs/message HTTP/1.1\r\nContent-Length: 173\r\nConten
t-Type: application/x-www-form-urlencoded\r\nhost: localhost:80\r\nConnection: k
eep-alive\r\n\r\n',
_headerSent: true,
parser: null,
res: [Circular] },
ondata: null },
_consuming: true,
_dumped: false,
httpVersionMajor: 1,
httpVersionMinor: 1,
upgrade: false,
req:
{ domain: null,
_events:
{ response: undefined,
socket: undefined,
error: [Function],
drain: [Function] },
_maxListeners: 10,
output: [],
outputEncodings: [],
writable: true,
_last: false,
chunkedEncoding: false,
shouldKeepAlive: true,
useChunkedEncodingByDefault: true,
sendDate: false,
_hasBody: true,
_trailer: '',
finished: true,
_hangupClose: false,
socket:
{ _connecting: false,
_handle: [Object],
_readableState: [Object],
readable: true,
domain: null,
_events: [Object],
_maxListeners: 10,
_writableState: [Object],
writable: true,
allowHalfOpen: false,
onend: null,
destroyed: false,
errorEmitted: false,
bytesRead: 1480,
_bytesDispatched: 320,
_pendingData: null,
_pendingEncoding: '',
parser: null,
_httpMessage: [Circular],
ondata: null },
connection:
{ _connecting: false,
_handle: [Object],
_readableState: [Object],
readable: true,
domain: null,
_events: [Object],
_maxListeners: 10,
_writableState: [Object],
writable: true,
allowHalfOpen: false,
onend: null,
destroyed: false,
errorEmitted: false,
bytesRead: 1480,
_bytesDispatched: 320,
_pendingData: null,
_pendingEncoding: '',
parser: null,
_httpMessage: [Circular],
ondata: null },
agent:
{ domain: null,
_events: [Object],
_maxListeners: 10,
options: {},
requests: {},
sockets: [Object],
maxSockets: 5,
createConnection: [Function] },
socketPath: undefined,
method: 'POST',
path: '/nodejs/message',
_headers:
{ 'content-length': 173,
'content-type': 'application/x-www-form-urlencoded',
host: 'localhost:80' },
_headerNames:
{ 'content-length': 'Content-Length',
'content-type': 'Content-Type',
host: 'host' },
_header: 'POST /nodejs/message HTTP/1.1\r\nContent-Length: 173\r\nContent-T
ype: application/x-www-form-urlencoded\r\nhost: localhost:80\r\nConnection: keep
-alive\r\n\r\n',
_headerSent: true,
parser: null,
res: [Circular] },
pipe: [Function],
addListener: [Function],
on: [Function],
pause: [Function],
resume: [Function],
read: [Function],
request:
{ domain: null,
_events:
{ error: [Function],
complete: [Function],
pipe: [Object],
end: [Object],
data: [Function] },
_maxListeners: 10,
readable: true,
writable: true,
uri:
{ protocol: 'http:',
slashes: true,
auth: null,
host: 'localhost:80',
port: '80',
hostname: 'localhost',
hash: null,
search: null,
query: null,
pathname: '/nodejs/message',
path: '/nodejs/message',
href: 'http://localhost:80/nodejs/message' },
body: ,
headers:
{ 'Content-Length': 173,
'Content-Type': 'application/x-www-form-urlencoded' },
method: 'POST',
callback: [Function],
explicitMethod: true,
localAddress: undefined,
pool: {},
dests: [],
__isRequestRequest: true,
_callback: [Function],
_redirectsFollowed: 0,
maxRedirects: 10,
followRedirect: true,
followAllRedirects: false,
redirects: [],
setHost: true,
originalCookieHeader: undefined,
_jar: undefined,
port: '80',
host: 'localhost',
clientErrorHandler: [Function],
_parserErrorHandler: [Function],
path: '/nodejs/message',
httpModule:
{ parsers: [Object],
STATUS_CODES: [Object],
IncomingMessage: [Object],
OutgoingMessage: [Object],
ServerResponse: [Object],
Agent: [Object],
globalAgent: [Object],
ClientRequest: [Object],
request: [Function],
get: [Function],
Server: [Object],
createServer: [Function],
_connectionListener: [Function: connectionListener],
Client: [Function: deprecated],
createClient: [Function: deprecated] },
agentClass: { [Function: Agent] super_: [Object], defaultMaxSockets: 5 },
agent:
{ domain: null,
_events: [Object],
_maxListeners: 10,
options: {},
requests: {},
sockets: [Object],
maxSockets: 5,
createConnection: [Function] },
_started: true,
href: 'http://localhost:80/nodejs/message',
req:
{ domain: null,
_events: [Object],
_maxListeners: 10,
output: [],
outputEncodings: [],
writable: true,
_last: false,
chunkedEncoding: false,
shouldKeepAlive: true,
useChunkedEncodingByDefault: true,
sendDate: false,
_hasBody: true,
_trailer: '',
finished: true,
_hangupClose: false,
socket: [Object],
connection: [Object],
agent: [Object],
socketPath: undefined,
method: 'POST',
path: '/nodejs/message',
_headers: [Object],
_headerNames: [Object],
_header: 'POST /nodejs/message HTTP/1.1\r\nContent-Length: 173\r\nConten
t-Type: application/x-www-form-urlencoded\r\nhost: localhost:80\r\nConnection: k
eep-alive\r\n\r\n',
_headerSent: true,
parser: null,
res: [Circular] },
ntick: true,
response: [Circular],
_destdata: true,
_ended: true,
_callbackCalled: true },
toJSON: [Function: toJSON],
body: '<?xml version="1.0" encoding="UTF-8"?>\r\n\r\n\r\n
\r\nObject not found!\r\n\r\n

*/-->\r\n\r\n\r\n\r\nObject not found!\r\
n

\r\n\r\n\r\n The requested URL was not found on this server.\r\n\r\n \r\
n\r\n If you entered the URL manually please check your\r\n spelling and t
ry again.\r\n\r\n \r\n\r\n

\r\n

\r\nIf you think this is a server error, p
lease contact\r\nthe webmaster.\r\n\r\
n

\r\n\r\n

Error 404

\r\n\r\n localhost
\r\n Apache/2.4.3 (Win32) OpenSSL/1.0.1c PHP/5.4.7\r\n\
r\n\r\n\r\n\r\n' }

Any idea