Sending client to channel messages with nodejs integration

by Neograph734   Last Updated April 08, 2015 22:03 PM

I've been struggling with this for some weeks now and so far I have not found a proper solution yet. I guess this is a bug, but since there is no response on nodejs issue queue I'd like to ask this question here as well. ( issue)

The situation:

I am working on a conference plugin using webRTC, where the initial handshake is done using Nodejs integration module. (Needed Nodejs for some other applications as well so I thought this would be the best way.) There is some documentation on how to send messages from client > node server > backend (> other clients). However for my handshake it has no added value to use the Drupal backend, so I want messages to go client > node server > channel.

The Nodejs integration module has settings for allowing clients to write to channels and in fact the messages arrive on the server, the server sends them to the connected clients and the clients reject the messages.

The idea:

I've tracked it down to the following piece of client side javascript in the nodejs module, where both message.clientSocketId and Drupal.Nodejs.socket.sessionid are undefined (thus equal) and the callback is left.

Drupal.Nodejs.runCallbacks = function (message) {
  // It's possible that this message originated from an ajax request from the
  // client associated with this socket.
  if (message.clientSocketId == Drupal.Nodejs.socket.sessionid) {

Is there somebody who managed to get client > node server > channel communication using only JavaScript? Did I miss an authentication step somewhere?

Commenting out the return statement does work, but then clients respond to their own messages, leading to undesired behavior.

Tags : 7 javascript

Answers 1

I can no longer reproduce this. Since the module did not update in the meantime I guess it a new version of that got updated via npm update.

The posts here have been of great help in further development of the functionality:

April 08, 2015 19:58 PM

Related Questions

Use drupal.settings variables on javascript

Updated March 27, 2015 14:18 PM

Passing Javascript variable in my module file

Updated July 27, 2015 14:03 PM

Remove jquery script

Updated April 20, 2015 21:03 PM

Calling a contact form in a certain page

Updated August 23, 2015 17:03 PM