diff --git a/nodejs.module b/nodejs.module
index 3b6170e..0f3e719 100644
--- a/nodejs.module
+++ b/nodejs.module
@@ -37,7 +37,11 @@ function nodejs_send_content_channel_token($channel, $notify_on_disconnect = FAL
       // We always set this in drupal.settings, even though Ajax requests will not
       // see it. It's a bit ugly, but it means that setting the tokens for full
       // page requests will just work.
-      drupal_add_js(array('nodejs' => array('contentTokens' => array($channel => $message->token))), array('type' => 'setting'));
+      $js_libs['#attached']['js'] = array(
+        'type' => 'setting',
+        'data' => array ('nodejs' => array('contentTokens' => array($channel => $message->token))),
+      );
+      drupal_render($js_libs);
 
       $node_response->token = $message->token;
       return $node_response;
