If you have error from NodeJS server like this: "The channel "ajax_comments_nodejs_NID" doesn't exist".
And you add comment output in View or Panels.
This may can help you:
Add this code to PHP-field in View
$nid = $view->args[0]; // <--- this variable is very necessary
// You can receive NID from other way. This is only for example.
nodejs_send_content_channel_token('ajax_comments_nodejs_' . $nid);
drupal_add_js(drupal_get_path('module', 'ajax_comments_nodejs') . '/nodejs.ajaxcomments.js', array('type' => 'file'));
drupal_add_js(drupal_get_path('module', 'ajax_comments') .'/ajax_comments.js', array('type' => 'file'));
drupal_add_css(drupal_get_path('module', 'ajax_comments_nodejs') .'/ajax_comments_nodejs.css', array('type' => 'file'));
Note: above code you can add to page from /themeName/template.php use Hook of course =).
The second problem I have with sync comment (sender and receiver side) via NodeJs.
Looking at the ajaxMessage(XHR) sender and receiver, it was found that the sender gives JSON-array with 4-keys(comment body was an array) but receiver gets JSON-array with only 1-key, without comment body in array.
fix this add "waiting" loop in ajax_comment_nodejs.module:
function _ajax_comments_nodejs_view_added($cid) {
$commands = array();
do {} while (empty(comment_load($cid))); // <--- waiting loop
if (!empty($cid)) {
$comment = comment_load($cid);
$node = node_load($comment->nid, NULL, TRUE);
if ($comment) {
Comments
Comment #2
meles CreditAttribution: meles commented