The messages are being accepted by text field, but nothing shows up in the chat window until refreshing the chat page.
Contents of nodejs.config.js:
settings = {
scheme: 'http',
port: 8081,
host: '192.168.1.80',
resource: '/socket.io',
serviceKey: 'asdfasdfasdfasdf',
backend: {
port: 80,
host: 'therighturl.com',
scheme: 'http',
basePath: '',
messagePath: '/nodejs/message'
},
debug: true,
baseAuthPath: '/nodejs/message/',
publishUrl: 'nodejs/publish',
kickUserUrl: 'user/kick/:uid',
logoutUserUrl: 'user/logout/:authtoken',
clientsCanWriteToChannels: true,
clientsCanWriteToClients: true,
addUserToChannelUrl: 'user/channel/add/:channel/:uid',
removeUserFromChannelUrl: 'user/channel/remove/:channel/:uid',
addChannelUrl: 'channel/add/:channel',
removeChannelUrl: 'channel/remove/:channel',
setUserPresenceListUrl: 'user/presence-list/:uid/:uidList',
addAuthTokenToChannelUrl: 'authtoken/channel/add/:channel/:uid',
removeAuthTokenFromChannelUrl: 'authtoken/channel/remove/:channel/:uid',
toggleDebugUrl: 'debug/toggle',
contentTokenUrl: 'content/token',
publishMessageToContentChannelUrl: 'nodejs/message',
transports: ['websocket', 'flashsocket', 'htmlfile', 'xhr-polling', 'jsonp-polling'],
jsMinification: true,
jsEtag: true,
};
Here is the output from the node process.
info - socket.io started
Authenticating client with key "6227d8815f18976b25c9833f33c2c95f"
Sending message to backend { authToken: '6227d8815f18976b25c9833f33c2c95f',
messageType: 'authenticate',
clientId: 'Kdz5d-EM_lJm4EWWwiVq' } { uri: 'http://therighturl.com:80/nodejs/message',
body: 'messageJson=%7B%22authToken%22%3A%226227d8815f18976b25c9833f33c2c95f%22%2C%22messageType%22%3A%22authenticate%22%2C%22clientId%22%3A%22Kdz5d-EM_lJm4EWWwiVq%22%7D&serviceKey=asdfasdfasdfasdf',
headers:
{ 'Content-Length': 189,
'Content-Type': 'application/x-www-form-urlencoded' } }
Authenticating client with key "f126e8a54de8b440076dc33a1e085015"
Sending message to backend { authToken: 'f126e8a54de8b440076dc33a1e085015',
messageType: 'authenticate',
clientId: 'joQU2UresWee5MMBwiVr' } { uri: 'http://therighturl.com:80/nodejs/message',
body: 'messageJson=%7B%22authToken%22%3A%22f126e8a54de8b440076dc33a1e085015%22%2C%22messageType%22%3A%22authenticate%22%2C%22clientId%22%3A%22joQU2UresWee5MMBwiVr%22%7D&serviceKey=asdfasdfasdfasdf',
headers:
{ 'Content-Length': 189,
'Content-Type': 'application/x-www-form-urlencoded' } }
Valid login for uid " 1 "
sendPresenceChangeNotification 1 online { '1': [] }
Added channels for uid 1: nodejs_user_1,nodejs_ajax_broadcast,watchdog_dblog
setupClientConnection { '1': [] }
Valid login for uid " 1 "
Added channels for uid 1: nodejs_user_1,nodejs_ajax_broadcast,watchdog_dblog
setupClientConnection { '1': [] }
Drupal log error:
Error sending content token "29HXDfLGjjK7pstyQVK5urYqIERa6QsfZckG0djhvxI" to the Node.js server: [404] Not Found
Apache2 log after posting a message, but before refresh:
192.168.1.99 - - [27/Sep/2012:04:27:45 -0400] "POST /chatroom/message/post/4 HTTP/1.1" 200 439 "http://therighturl.com/content/chat" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/536.11 (KHTML, like Gecko) Ubuntu/12.04 Chromium/20.0.1132.47 Chrome/20.0.1132.47 Safari/536.11"
Let me know if there's any other information that I can provide.
Comments
Comment #1
remon_m CreditAttribution: remon_m commentedAny progress here? I have the same issue and still unable to fix it.
Comment #2
markwk CreditAttribution: markwk commentedThere is obviously a configuration or setup issue between node.js and chatroom. Checkout this helpful post: http://www.gizra.com/content/drupal-nodejs-pantheon-and-heroku
Comment #3
Rory CreditAttribution: Rory commentedWhen I post a message in chat the node.js server debug reports the message:
But the callback which is mentioned in the debug, chatroomMessageHandler, never ends up being called. This callback is set under chatroom.js (see below) and you can see it is responsible for updating the display, but something is preventing this callback from running.
Comment #4
sahithya06 CreditAttribution: sahithya06 commentedI am facing the same error, were you able to resolve it? If so, could you let me know how?
Comment #5
Rory CreditAttribution: Rory commentedSorry, no, I was not able to! I would like to re-visit this module, so hopefully someone else can.
Comment #6
mobabo CreditAttribution: mobabo commentedSame problem. The chatroomMessageHandler callback is never getting called in the client. I assume this means the message from the server isn't addressed correctly, e.g. a config error.. but the message appearing on refresh means the server IS able to communicate with the client/drupal at some point.
I was using node-debugger to try stepping through the response process, but it's impenetrable to me. I could find the socket being used to write the response, but couldn't find how the socket was created/what address it was connected to, etcetera.
Any help from someone with more expertise? Debugging tips also welcome. Does this sound like a config issue?
Comment #7
mobabo CreditAttribution: mobabo commentedI've fixed my problem, but on further review it might not be the same issue as the original poster. I also did not get messages unless I refreshed, but I did not have the apache errors they mentioned.
My issue was with basePath and messagePath. I can examine these values in server.js, and basePath is not prepended to messagePath as I expected. Typing the full path for messagePath solved my issues. It doesn't seem to matter what I put in basePath. Is that intended?
e.g., my site is at http://localhost/trunk/drupal-7.19.
Original nodejs.config.js excerpt, which did NOT work (messagePath in server.js = /nodejs/message)
basePath: '/trunk/drupal-7.19',
messagePath: '/nodejs/message'
Both of the following DO work:
basePath: '/trunk/drupal',
messagePath: '/trunk/drupal-7.19/nodejs/message'
basePath: '',
messagePath: '/trunk/drupal-7.19/nodejs/message'
I've seen some mention that node.js/chat worked for them on their server, but not localhost. Perhaps like me, on their server their site is at root (so /nodejs/message works) but on localhost it is down a few levels.
Comment #8
Anonymous (not verified) CreditAttribution: Anonymous commentedComment #9
Rory CreditAttribution: Rory commented@beejeebus did you mean to mark this as designed? The issue is that messages do not show up until page refresh. @mobabo writes:
It would be backwards for a chat room if you had to refresh the page all the time. The module integrates with Node.js integration so I think this is not by design.
Comment #10
nibennet CreditAttribution: nibennet commentedI, too, had problems getting text to display in the chat window, even after refresh. I doubt the issue with text not appearing until after refresh was not "intended by design"... I would love to be able to get this module to work for my site. All of the other chat modules are paid and for someone starting out that can mean the difference between being able to have a chat room or not.
Comment #11
Anonymous (not verified) CreditAttribution: Anonymous commentedyes, i meant it.
this is likely node.js configuration issues, and i'm going to assume that until proven otherwise.