PDA

View Full Version : "command received" callbacks?


kbanks
05-23-2008, 09:39 AM
(reposted from a customer email)

Does node have any way to indicate to a script that a (any) message/command/valid packet was received? Like some kind of call back or a hook?

What SNAPpy does is more simple and direct than a callback or hook. To have a node act upon reception of some command "doSomething()", just define a "doSomething()" function in that node's SNAPpy script.

The remotely executable procedures can even have parameters.

If you want to track if any of a set of functions has been invoked, have them all modify the same global flag. If you want all invoked functions to take some common action, have them invoke the same shared function.