HEADS-project / heads_ide

http://heads-project.eu
9 stars 2 forks source link

OnConnect / OnDisconnect #63

Closed kehusa closed 9 years ago

kehusa commented 9 years ago

After trying the new OnConnect statement in kevs I have a couple of questions/observations:

  1. It seems like the model is not updated when a node detaches from the master. It is still present.
  2. When one node i detached, the master complains about a channel that is not present: 11:32:22 WARN WSMsgBroker "broker" broker warning: Unable to send messag e. Client "/nodes[jsClient]/components[ticker]/required[tick]_chan" unknown

The OnConnect is really cool feature. I think it could be even enhanced a bit such that you could have some decision logic on what is pushed out to the various nodes, based on e.g. the node name or node type. E.g. Android will have one kind of config while PI will have another.

maxleiko commented 9 years ago

@kehusa it wasn't the purpose of the feature to remove the node from the model on disconnection
The onConnect will only be processed and send to nodes when they connect to the master node (or reconnect)

kehusa commented 9 years ago

OK, I realize that, but isn't that a natural consequence to also update the model when a node is detached?

maxleiko commented 9 years ago

Not necessarily, but we could imagine something like a onDisconnect, where you would add something like:

remove {nodeName}

Which will reflect that "dynamic" behavior

kehusa commented 9 years ago

Sounds good. I think this would make the "dynamic" feature of kevscript more complete.

maxleiko commented 9 years ago

@kehusa working example with onDisconnect here

Just pull the repo :)

kehusa commented 9 years ago

When powering off the dynamically attached node (not just stopping the process), the master does not recognize that. I think one cannot rely on the websocket "events" but perhaps has to put something to actively check the links.

maxleiko commented 9 years ago

Okay, think I know why this is happening. The error event is not running onDisconnect KevScript, and I think that it should in this use-case.
I'm going to investigate that next week :)

maxleiko commented 9 years ago

But the close event does ;) That's why you have the right behaviour on 'kill' (I guess)

maxleiko commented 9 years ago

Ok so, after further investigations, I found that there is no other solution than a ping/pong feature. I'll release a fix with this feature today :)

kehusa commented 9 years ago

Is this fix done/included in 5.2.9?

2015-05-06 11:57 GMT+02:00 Maxime Tricoire notifications@github.com:

Ok so, after further investigations, I found that there is no other solution than a ping/pong feature. I'll release a fix with this feature today :)

— Reply to this email directly or view it on GitHub https://github.com/HEADS-project/heads_ide/issues/63#issuecomment-99403126 .

| Knut Eilif Husa | CTO | Tellu AS | Hagaløkkveien 13, 1383 Asker - NORWAY| Direct: +47 452 49496 | www.tellu.no |

This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system.

maxleiko commented 9 years ago

Yes