Chat displays the online users but everything I write gets cleared and isn't displayed anywhere.
Part of my nodejs.config.js:

  "clientsCanWriteToChannels":true,
  "clientsCanWriteToClients":true,
  "extensions": "",

Comments

slv_’s picture

You need to add the extension included with the module to the nodejs.config.js extensions property.

Copied from the readme.txt:

4. If you're a site builder and just want to use the module's default features,
you need to enable the "nodejs_chat.module.js" extension that is located
under the "extensions" folder of the module in your Node JS server. Make
sure that at least either the property "clientsCanWriteToChannels" or the
property "clientsCanWriteToClients" is set to true in the "nodejs.config.js"
file of your Node JS Server.

Apart from copying it to the nodejs server, of course don't forget to enable it on the extensions property, like:

extensions: ['nodejs_chat.module.js'],

Let me know if that works.

By the way, the current dev version of the module conflicts with the current dev version of the nodejs module (the one updated 2 days ago), as I committed a big patch to it that changes the way http requests to the server are handled. I'll commit the changes to adapt this module during the weekend.

mkesper’s picture

Now I get: Failed to load extension nodejs_chat.js [ReferenceError: jQuery is not defined].

slv_’s picture

I think you're adding the wrong file to the extensions:

it is

['nodejs_chat.module.js']

Not

['nodejs_chat.js']

The right file is in the "extensions" directory of the module. The common nodejs_chat.js file is just what users get on their browsers to handle the chat events, but nothing that you have to add to the node server.

Apart from adding the right one to the extensions array, of course make sure you put it on the nodejs server folder!

mkesper’s picture

Ok, that was a stupid error. ;)

But alas, the next one is:
Fatal error: Call to undefined function nodejs_get_check_channel() in C:\xampp\htdocs\drupal\sites\all\modules\nodejs_chat\includes\Chat.inc on line 57

slv_’s picture

That means you have the very last version of my module, but not the last version of nodejs module. We added that function recently to it, so make sure you update to the latest version. In fact, this required the DEV version of the nodejs module -> http://drupal.org/node/1160868

mkesper’s picture

Now I get blank pages for pages in which the module is enabled.
And a Notice: Trying to get property of non-object in nodejs_requirements() (Zeile 78 von C:\xampp\htdocs\drupal\sites\all\modules\nodejs\nodejs.install

slv_’s picture

That seems to be because of a recent change introduced on how the requests to the server are handled by the module. Try the 7.2 release, I think that should have the function mentioned in the previous comments, but not this last change.

Otherwise, the nodejs module itself needs to fix that function asap. Anyways I'll check with the module maintainer to get it fixed. But, once again, 7.2 should be fine for the time being I think.

mkesper’s picture

Sorry, where can I find the 7.2 release? I can only find 7.x-1.x-dev

slv_’s picture

My bad, typed it wrong, it's 7.2 -> http://drupal.org/node/1979410 (I was meaning of the nodejs module, not the nodejs_chat module).

mkesper’s picture

Ok, thanks! :)

slv_’s picture

Status: Active » Closed (works as designed)

I guess this worked fine for you, so marking the issue as fixed.

seanr’s picture

Title: Chats get created but nothing gets posted » Better installation/configuration documentation needed
Component: Code » Documentation
Category: Bug report » Support request
Issue summary: View changes
Status: Closed (works as designed) » Active

4. If you're a site builder and just want to use the module's default features,
you need to enable the "nodejs_chat.module.js" extension that is located
under the "extensions" folder of the module in your Node JS server. Make
sure that at least either the property "clientsCanWriteToChannels" or the
property "clientsCanWriteToClients" is set to true in the "nodejs.config.js"
file of your Node JS Server.

Please define "enable the "nodejs_chat.module.js" extension" - I have no idea how to enable it?

I'm getting [Error: Cannot find module '/.../sites/all/modules/contrib/nodejs/nodejs_chat.module.js'] - do I have to copy it to the nodejs module's folder? That seems like bad news if I ever upgrade nodejs in the future - there's no kind of library system?

In general, the documentation for both this and the nodejs module is rather vague. Hence, you're seeing a lot of repeated questions and general confusion. A working example setup and improved instructions would really go a long way here. As it stands, I can only glean enough info from this to get halfway to a working setup. :-(

  • slv_ committed 8f8d01e on 7.x-1.x
    Issue #1991836: Better installation/configuration documentation needed
    
slv_’s picture

Status: Active » Closed (fixed)

Hi seanr. I think you're right. That particular is not too clear for people not familiar with the nodejs module.

Relevant docs about enabling extensions should be on that module, rather on others like the chat one, but I've improved the README file, so Step 4 is split down into more concise tasks.

4. If you're a site builder and just want to use the module's default features,
    you need to configure your Node JS Server (from the nodejs module) to use
    the "nodejs_chat.module.js" extension that comes with this module. To do so:

    4.1 Go to the "extensions" folder of this module, and grab the
        "nodejs_chat.module.js" file.

    4.2 Go to the folder where you've placed the Node JS Server (this is, the
        "server.js" file from the nodejs_chat module), and paste the file there.

    4.3 Enable the extension in your Node JS Server config. So, in the file
        "nodejs.config.js", look for this line:

            - extensions: []

        And replace it with:

            - extensions: ['nodejs_chat.module.js']

    4.4 Make sure that at least either the property "clientsCanWriteToChannels"
        or the property "clientsCanWriteToClients" is set to true in the
        "nodejs.config.js" file of your Node JS Server.

    4.5 If the Node JS Server was running, restart it.

Closing.