Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
In a node with comments, I would like that comments get auto-updated when new comments (from other users) get submitted. Any chance to get this implemented with ajax-comments ?
I installed and tested nodejs if that matter.
Note: I thought I have read somewhere that ajax-comments had this feature with nodejs integration, but I can't find it any more, so I am putting it as a feature request.
Comment | File | Size | Author |
---|---|---|---|
#8 | node_config2.png | 38.99 KB | sylvaticus |
#8 | node_config1.png | 18.54 KB | sylvaticus |
Comments
Comment #1
formatC'vt CreditAttribution: formatC'vt commentedYes, you can do this with nodejs. Just enable AJAX Comments Nodejs Integration module (this module a part of AJAX Comments module)
Comment #2
sylvaticus CreditAttribution: sylvaticus commentedHi, thanks for the quick reply.
that's great.. however for some reasons here it's not working: comments get sent and self-sent comments correctly got displayed, but the comment section is not updated when a comment is sent from the other browser/user.
In the shell where I have nodejs opened I can read messages like:
However comments' page doesn't get updated. I debugged to Firebug but I don't have any error in the console.
I have created a test case here:
https://booksforum.org/content/chatroom/new-chat-room-test
with username test1 and test2 and password ajaxcomments
Please let me know how could I debug it further.
Thank you..
Comment #3
formatC'vt CreditAttribution: formatC'vt commentedthis is can be a theme level issue, but thanks for a test case, i will do same tests tonight.
Comment #4
sylvaticus CreditAttribution: sylvaticus commentedHi.. thanks again for the quick reply.
I reverted to the default D7 theme (Bartik), but changing theme seems to have no effect: comments don't get reloaded when nodejs broadcast the new comment from an other user (I now installed switchtheme so there is a block to switch to Bartik)...
Comment #5
formatC'vt CreditAttribution: formatC'vt commentedNodeJS doesn't work for me because of "GET https://localhost:8080/socket.io/socket.io.js"
and my localhost without nodejs =)
Comment #6
sylvaticus CreditAttribution: sylvaticus commentedI am sorry. I left the localhost default as for the server-to-server connections. I went trough the nodejs documentation up to "Test your configuration", I got the test message and I assumed it was working.
I'll have to grab now where to change localhost for my actual site name within the 4 different "host" parameters, but it's a problem of nodejs module configuration, this module should work as expected...
Thanks again for your support
Comment #7
formatC'vt CreditAttribution: formatC'vt commentedi have two host definitions in
nodejs.config.js
.first - host name or IP address that the node server should listen on.
second - host name of the Drupal site
try this:
Comment #8
sylvaticus CreditAttribution: sylvaticus commentedThanks again... I slightly modified the config file to use the https, otherwise I have an error in the Firefox console about not loading the content as it is a mixed http/https:
So my nodejs.config.js file is:
But how should I set /admin/config/nodejs/config and - if needed - /admin/config/nodejs/js ?
Here is how I have set them:
/admin/config/nodejs/config :
/admin/config/nodejs/js :
In particular I have done anything other than following the nodejs documentation. I don't know what that socket.io and publish parameters refer, I left the default values...
I also opened the port 8080 in the firewall, but if I nmap it I have it reported as close, unless I set the first host in nodejs config file as 0.0.0.0
Comment #9
SocialNicheGuru CreditAttribution: SocialNicheGuru commentedwhen i enable "debug:true' in nodejs.config.js file I get this in the log when I click on save for my comment
publishMessageToContentChannel: message { channel: 'ajax_comments_nodejs_1',
callback: 'ajaxCommentsNodejs',
authToken: 'xxxxx',
action: 'added',
cid: '2',
clientSocketId: 'yyyyy' }
publishMessageToContentChannel: The channel "ajax_comments_nodejs_1" doesn't exist
Comment #10
formatC'vt CreditAttribution: formatC'vt commentedhm, channel should be created by
ajax_comments_nodejs_process_node()
Comment #11
formatC'vt CreditAttribution: formatC'vt commentedoh, my bad, patch coming soon
Comment #13
formatC'vt CreditAttribution: formatC'vt commentedtry latest dev, please
Comment #14
SocialNicheGuru CreditAttribution: SocialNicheGuru commentedStill got the same error:
'publishMessageToContentChannel: The channel "ajax_comments_nodejs_1" doesn't exist'
I am user 1.
Comment #15
formatC'vt CreditAttribution: formatC'vt commentedajax_comments_nodejs_X - where X number is node id, not user id.
I can't reproduce this bug, can you, please, give me more details about your case.
Comment #16
SocialNicheGuru CreditAttribution: SocialNicheGuru commentedI use nodejs with ajax_comments
nodejs is enabled properly
When I hit save on a comment, I see this in the nodejs debug log.
Shouldn't ajax_comments_nodejs_1 exist?
publishMessageToContentChannel: message { channel: 'ajax_comments_nodejs_1',
callback: 'ajaxCommentsNodejs',
authToken: '47f39c946ed7381dc3c36a386dcb4c6e',
action: 'added',
cid: '17',
clientSocketId: '' }
publishMessageToContentChannel: The channel "ajax_comments_nodejs_1" doesn't exist.
Comment #17
JuliaKoelsch CreditAttribution: JuliaKoelsch commentedI was having the same issue, and found the cause for my situation: I am displaying comments on my page via the "Node Comment Block" module. So, when this module checks to see if it should enable the channel for the node being viewed (in ajax_comments_nodejs_process_node), the if statement fails because $variables['content']['comments'] is not set.
I removed this check from the if statement, and the auto-refresh worked perfectly!
Basically, I changed the first line of ajax_comments_nodejs_process_node(&$variables) in ajax_comments_nodejs.module (line 12) from this:
if (isset($variables['content']['comments']) && $variables['node']->comment == COMMENT_NODE_OPEN && ajax_comments_node_type_active($variables['node']->type)) {
to this
if ($variables['node']->comment == COMMENT_NODE_OPEN && ajax_comments_node_type_active($variables['node']->type)) {
@formatC'vt, would it be possible to make this modification, to support different ways of including comments on a page? I'm happy to supply a patch. I just didn't know if this modification would have unintended consequences.
Thanks!
Comment #19
formatC'vt CreditAttribution: formatC'vt commentedyep, i agree, we should enable channel on all content with opened comments and enabled ajax_comments.
try latest dev, please.
Comment #20
JuliaKoelsch CreditAttribution: JuliaKoelsch at Spry Digital, LLC commentedWorks perfectly. Thanks for committing it!
Comment #21
formatC'vt CreditAttribution: formatC'vt commentedComment #22
qzmenkoComment #23
qzmenkoMarked as "Fixed" because reviewed in comment #20