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

remon_m’s picture

Any progress here? I have the same issue and still unable to fix it.

markwk’s picture

There 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

Rory’s picture

When I post a message in chat the node.js server debug reports the message:

publishMessageToContentChannel: message { channel: 'chatroom_1',
  callback: 'chatroomMessageHandler',
  data: 
   { cid: '1',
     cmid: '34',
     uid: '1',
     timestamp: 1361082150,
     msg: '<div class="new-message chatroom-msg"><span class="chatroom-message-date">06:22:30</span> <span class="chatroom-message-username"><a href="/user/1" title="View user profile." class="username" xml:lang="" about="/user/1" typeof="sioc:UserAccount" property="foaf:name">host</a></span>: <p>Hello world</p>\n</div>' },
  clientSocketId: '' }

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.

Drupal.Nodejs.callbacks.chatroomMessageHandler = {
  callback: function (message) {
    Drupal.chatroom.addMessageToBoard(message.data);
  }
}; 
sahithya06’s picture

I am facing the same error, were you able to resolve it? If so, could you let me know how?

Rory’s picture

Sorry, no, I was not able to! I would like to re-visit this module, so hopefully someone else can.

mobabo’s picture

Same 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?

mobabo’s picture

I'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.

Anonymous’s picture

Status: Active » Closed (works as designed)
Rory’s picture

Status: Closed (works as designed) » Active

@beejeebus did you mean to mark this as designed? The issue is that messages do not show up until page refresh. @mobabo writes:

I also did not get messages unless I refreshed...

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.

nibennet’s picture

I, 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.

Anonymous’s picture

Status: Active » Closed (won't fix)

yes, i meant it.

this is likely node.js configuration issues, and i'm going to assume that until proven otherwise.