How to handle spreads of Observables?

hi all

I want to creat a small nodeset for my custom case. they work like buttons. each node I place inside my patch connects itself through a global context (datatype cable) to the controller. when an event happens at one of my nodes, it is sent to that controller. the controller does filtering and the logic.

I prototyped this with dictionaries, but of course, it scales pretty badly performence wise.
I guess this could be done much smarter with observables. Or is there even a better way?

I had a look at the node workshop, the grey book and every other reactive resource I could find.
I do not quite understand how to handle spreads of observables. How does my controller identify which of my nodes did send the event?

Do I build “observable streams” from each of my nodes to the controller, or is there just one “observable stream” for all notifications coming from my custom nodes? Is the Observable a datatype that holds the information which node it was coming from?

MyNodeNotification(string nodename, bool value)

Is there a patch I could look into, or are there other examples available?


Maybe something like this :
MessageInterface.vl (41.3 KB)

I’m not fully pro on Gamma’s observable but here your pipeline would be of type Observable<IMessage>

IMessage would be the common interface for all your messages, it has in my example just one property : ID but could be extended to have Processes as well.

So all your messages must have a property ID but can also have their own specific Properties and Processes.

OnReceive you CastAs to check the concrete message type and do something with it.

Now when a node change you create whatever message you need to send through the pipe and your controller should know what to do with it.

if i understand correctly, you are trying to build this: Model-Runtime-Editor design pattern | vvvv

Thank you guys! I think I finally understood the observable pipeline in gamma. @lecloneur sending different messages on the same channel and then casting is also quite interesting. But I build it a bit differently for now.

@tonfilm why is this not better documented? I had a look at all available resources, but in the end one simple patch explained everything. That thread that lecloneur mentioned, should go straight into the helpbrowser. At least the observable patch. I saw this pattern so often in different patches but never could make sense out of it. Turns out the “Subject” is part of the fully implemented observable interface.

I will have a look at dottores tutorial as well, thx for the hint!


This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.