when I launch nodejs module with drupal that version is 7.4, first issue is
1. the method "get" is undefined. server.js line 626.
I changed to

    server.all('/nodejs/*', checkServiceKeyCallback)
.post(backendSettings.publishUrl, publishMessage);
server.get(backendSettings.serverStatsUrl, returnServerStats)
server.get(backendSettings.getActiveChannelsUrl, getActiveChannels);
server.get(backendSettings.kickUserUrl, kickUser);
server.get(backendSettings.addUserToChannelUrl, addUserToChannel);
server.get(backendSettings.removeUserFromChannelUrl, removeUserFromChannel);
server.get(backendSettings.toggleDebugUrl, toggleDebug);
server.get('*', send404);
server.listen(backendSettings.port, backendSettings.host); 
  

and it can work now.
2. the "length" property is undefined. server.js line 307 when I check the nodejs stats. I add init the client with empty array at line 639

  if (socket.clients == undefined) socket.clients = {};
  

3. When I add user to channel with "/nodejs/user/channel/add" path, the nodejs tell me "No active sessions for uid: 2" the "2" is uid.
How to fix the latest BUG ? Or I miss some config ??
below is my nodejs.config.js file that created with default config.

  backendSettings = {
  'scheme': 'http',
  'host': '127.0.0.1',
  'port': 8081,
  'resource': '/node.js/realtime',
  'publishUrl': '/nodejs/publish',
  'serviceKey': '',
  'backend': {
    'port': 80,
    'host': '127.0.0.1',
    'authPath': '/nodejs/auth/'
   },
   'extensions': [],
   'clientsCanWriteToChannels': false,
   'clientsCanWriteToClients': false
};
 

Comments

Anonymous’s picture

Status: Needs review » Active
jziwenchen’s picture

Do you have any ideas ? :)

Gray Fox’s picture

I had your #1 issue while using an older version of socket.io, so you might want to install the latest versions of nodejs/express/socket.io. So far I had no issues with the nodejs-dev build on my Windows machine.

jziwenchen’s picture

what is the version of socket.io, express you used ?

Gray Fox’s picture

I'm not sure since I updated everything. I was using Windows binaries of node.js 0.4.7, so I switched to cygwin and compiled the latest version (at the time 0.4.9) from source. What OS are you using?

jziwenchen’s picture

hi,
I am on ubuntu 10.04. It is ok now when upgrade version of node.js module express, socket.io

Anonymous’s picture

Status: Active » Closed (cannot reproduce)

thanks for the feedback, closing for now, please reopen if you need to.

carnau’s picture

Version: 7.x-1.0-beta1 » 6.x-1.x-dev
Status: Closed (cannot reproduce) » Active

I'm dealing with this issue, so instead of creating another one I'll will use this.

I'm trying to port the nodejs functionality of drupalchat D7 into D6 version. So I'm using a custom drupalchat D6 dev version, and nodejs 6 dev.

I have 2 machines, one that has nodejs server and the other one with my drupal site. Both servers can communicate through 80 and 8080 port.

I've also done some test with wget / telnet to be sure, for example, that from the drupal site, socket.io.js is accessible. Website is also accesible.

My socket.io version is 0.8.6, and it's running on CentOs.

Everytime I write something into the chat, the nodejs side(server.js) shows:

getNodejsSessionIdsFromUid { uid: '70', sessionIds: [] }
No active sessions for uid: 70

My nodejs.config.js file:

backendSettings = {
  'scheme': 'http',
  'host': '',
  'port': 8080,
  'key': '/path/to/key/file',
  'cert': '/path/to/cert/file',
  'resource': '/node_modules/socket.io/lib',
  'publishUrl': '/nodejs/publish',
  'serviceKey': 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
  'backend': {
    'port': 80,
    'host': 'www.example.com',
    'messagePath': '/nodejs/message'
  },
  'extensions': ['drupalchat_nodejs.server.extension.js'],
  'clientsCanWriteToChannels': true,
  'clientsCanWriteToClients': true
,
  'transports': ['websocket', 'flashsocket', 'htmlfile', 'xhr-polling', 'jsonp-polling'],
  'jsMinification': true,
  'jsEtag': true,
  'logLevel': 1,
  'debug':true
};

(*) The 'host' option is blank to listen any ip. I've tried to put my drupal server ip but not works (see next error). Just works with blank, localhost or the server ip, so I can't restrict it to my other server.
In my drupal site, in the nodejs configuration form, host option points to nodejs.example.com, because it's used to construct some urls.

node.js:134
        throw e; // process.nextTick error, or 'error' event on first tick
        ^
Error: EADDRNOTAVAIL, Cannot assign requested address
    at HTTPServer._doListen (net.js:1100:5)
    at net.js:1071:14
    at Object.lookup (dns.js:159:5)
    at HTTPServer.listen (net.js:1065:20)
    at Object.<anonymous> (/data/nodejs/server.js:946:8)
    at Module._compile (module.js:411:26)
    at Object..js (module.js:417:10)
    at Module.load (module.js:343:31)
    at Function._load (module.js:302:12)
    at Array.<anonymous> (module.js:430:10)

I've noticed that the table nodejs_presence is empty, also if I logout / login on my website. Don't know if it is related to this issue.

Is there any tests I can follow to be sure that socket.io is well configured? Or what I have to check?