I've followed the installation instructions correctly (I think) but the chatbox won't show up. When I'm logged in as admin I get the error "The Chat channel couldn't be created". When I looked it it through Google Chrome's JavaScript console, the error is "Failed to load resource https://localhost:8080/socket.io/socket.io.js"

Could I have installed the module incorrectly?

Comments

slv_’s picture

Category: bug » support

I don't think you have installed it incorrectly if you've got to that point. It seems that your client is failing to load the socket.io javascript for the client-side that the nodejs server is supposed to provide.

In other words, your node js server (the server.js file provided by the nodejs module) is either not running (you have to do this with the command "node server.js" on the command line, within the folder where you've installed the server), or is not properly configured so your drupal site can't reach it. In any case, that's an installation issue with the nodejs module itself, not the nodejs_chat module.

It seems to be the first case, because otherwise, you would be able to at least create the chat channel, and not get that "Chat channel couldn't be created".

Not closing for now, in case you manage to install the server but still have problems with the chat module. Will leave open for some time ;).

slv_’s picture

Status: Active » Closed (works as designed)

Closing. Feel free to reopen if you come across new installation issues.

DanielDanielDaniel’s picture

Issue summary: View changes
Status: Closed (works as designed) » Active

Hello !

I have a similar problem with the installation.
I installed Node.JS on my root server, started the server.js with no errors.

When i refresh the page with the chat, sometimes it is able to create a channel, sometimes i get the error "could not create channel".
Node gives me the following debug output while i refresh the page:

Successfully added channel 'Chat__node_1'
setContentToken: message { token: 'ABfSaj9iB7rY7efYEPOp4v1CddJtTCE_uVnoTRUiKiA',
  channel: 'Chat__node_1',
  notifyOnDisconnect: true }
setContentToken ABfSaj9iB7rY7efYEPOp4v1CddJtTCE_uVnoTRUiKiA for channel Chat__node_1
publishMessageToContentChannel: message { broadcast: false,
  channel: 'Chat__node_1',
  callback: 'nodejsChatUserOnlineHandler',
  data:
   { chatroom: 'Chat__node_1',
     name: 'citycamcheck',
     subject: 'New user connected',
     body: 'User citycamcheck has entered the chat',
     user: { uid: '1', name: 'citycamcheck', picture: '0' } },
  clientSocketId: '' }
getNodejsSessionIdsFromUid { uid: '1', sessionIds: [] }
No active sessions for uid: 1

Also Chrome console tells me:

GET http://localhost:8080/socket.io/socket.io.js net::ERR_CONNECTION_REFUSED citycamcheck.de/:58

My nodejs.config.js is:

/**
* 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":"",
  "backend":{
  "port":80,
  "host":"localhost",
  "messagePath":"/nodejs/message"},
  "clientsCanWriteToChannels":true,
  "clientsCanWriteToClients":true,
  "extensions":["nodejs_chat.module.js"],
  "debug":true,
  "transports":["websocket",
  "flashsocket",
  "htmlfile",
  "xhr-polling",
  "jsonp-polling"],
  "jsMinification":true,
  "jsEtag":true,
  "logLevel":1};

I already tried to reinstall node.js, with no changes. Running it on Debian 7.5.
Do you have any ideas, or at least where to start searching ?

Yours

Daniel

slv_’s picture

Hi,

I think you there's something in your setup that makes the server not reachable in some cases.

Try to reproduce the issue, and see what's in the Drupal watchdog, filtering by "nodejs". Look for messages like "Error checking channel on the Node.js server", and see what details they throw, if there are any error messages.

Also, to be able to give more help, would you mind using #2137781: TEMPLATE to report new issues. ?

Finally, I tend to stay away of the config file created from the UI:

In the one you have, you've paths set for ssl certs, but those are dummy paths. Make sure to unset them:

Try with a config like this maybe:

settings = {
  scheme: 'http',
  port: 8080,
  host: '127.0.0.1',
  resource: '/socket.io',
  serviceKey: '',
  backend: {
    port: 80,
    host: '{the url you use to access your site},
    scheme: 'http',
    basePath: '',
    messagePath: '/nodejs/message'
  },
  debug: true,
  sslKeyPath: '',
  sslCertPath: '',
  sslCAPath: '',
  baseAuthPath: '/nodejs/',
  publishUrl: 'publish',
  kickUserUrl: 'user/kick/:uid',
  logoutUserUrl: 'user/logout/:authtoken',
  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: 'content/token/message',
  extensions: ['nodejs_chat.module.js'],
  clientsCanWriteToChannels: true,
  clientsCanWriteToClients: true,
  transports: ['websocket', 'flashsocket', 'htmlfile', 'xhr-polling', 'jsonp-polling'],
  jsMinification: true,
  jsEtag: true,
  logLevel: 1
};

Of course, replace the brackets on the marked 'host' with the appropriate URL! ;P

Hope that helps!

slv_’s picture

No comments for a month, so closing for now. Feel free to reopen if you still have problems with this.

slv_’s picture

Status: Active » Closed (works as designed)