Hi all,

That patch adds possibility to alter messages sent to node.js and attach js function names that will be executed on client side. We are developing module that needs that funtionality.

Comments

Anonymous’s picture

i'm not sure i like this approach.

i just looked at the node.js module, and i notice that there's no drupal_alter() for content channel messages. so, i've fixed that with this commit:

http://drupalcode.org/project/nodejs.git/commit/075db67

this should allow you to alter chatroom messages, and set the callback to your code. hopefully this gives you what you need for now.

i'm not totally opposed to adding a js-side 'hook' system that would fire after messages hit the browser, but i think it would need to look more like the system the node.js module uses to allow modules to register functionality.

Anonymous’s picture

Status: Patch (to be ported) » Needs work

setting to needs work, which is the usual status for things that need further discussion.

also, when you submit a patch, please set the status to needs review.

Alexander_Gurov’s picture

Thank you for recomendations

I'm agreed with your opininon about js-side 'hook' system - it will be great to have it on node.js and do not create hook system for each module. For now node.js allows to put only one callback to message. I'll try to write a patch for node.js module that will allow to attach several callback functions to one message without loosing previous functionality. Also callbacks should be ordered on server side. What do you think about that idea?

Anonymous’s picture

Project: Chatroom » Node.js integration
Version: 7.x-2.x-dev » 7.x-1.x-dev

yes, adding the ability to specify several callbacks works for me, moving this issue to the node.js queue.

i think the only change necessary would be to make nodejs.js check if callback was a list or a string, and iterate if its a list.

Anonymous’s picture

Title: Push message alter patch » Allow for message.callback to be a list

updating title.

Alexander_Gurov’s picture

StatusFileSize
new1.08 KB

Please review that small patch for node.js script

Anonymous’s picture

Status: Needs work » Fixed

thanks! committed a modified version here:

http://drupalcode.org/project/nodejs.git/commit/cce53fb

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

  • Commit cce53fb on 7.x-1.x, auth-refactor, 8.x-1.x, 8.x-1.x-head:
    #1707862 by Alexander_Gurov, beejeebus: allow specifying a list of...