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. (Drupal.org 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) {
return;
}
...
}
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.