Hi there! I’m working on a live performance that uses websocket to communicate between my patch and the public via their smartphones.
I have a series of incoming messages of different type and I would like to do different things (namely: call different functions) based on the type of the message. Is there any good pattern for this?
In the previous version I used a loong chain of If
statements, but it doesn’t feel right. Server side (node.js) i’ve approached this with Object Literals, using the type of the message as a key and the function as a value. (more here)
Could I do something similar also in gamma? Another way to approach this maybe could be something like the composition pattern, but then again, how to switch dynamically between nodes?
ciao ciao