[Opa] Network.channel

Mads Jensen mads379 at gmail.com
Wed Aug 17 19:33:07 EDT 2011


Hi guys,

I have some questions regarding Network.channel. I want to create ad-hoc
channel rather than the static ones in the chat example. The way I'm doing
it right now is
I'm cheating a channel with an id (as a string) and saving it in a
UserContext. From the documentation I got the impression that the
Network.channel would create
'singleton' like instances where that two consecutive calls to Network.cloud
would return the same instance rather than creating two different ones.

so my question is this: when I call Network.add_callback will it then be
registered for "all" channels? Here's an example.

channel = Network.cloud(name): Network.network(message)
Network.add_callback(message_recieved, channel)
UserContext.change(_ -> channel, state)

.... later, somewhere else in another lexical scope .....

channel = Network.cloud(name): Network.network(message)
UserContext.change(_ -> channel, state)

.... later again, somewhere else in another lexical scope .....

channel = UserContext.execute( x -> x, state)
channel.broadcast(..., channel) // will this get registrered by
message_recieved?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.owasp.org/pipermail/opa/attachments/20110818/77a13d2b/attachment.html 


More information about the Opa mailing list