6

As far as I can tell there are 7 events dispatched by a NoFlo port:

attach, connect, begingroup, data, endgroup, disconnect, detach

To me some of these events sound very similar such as attach + connect, and disconnect + detach. What is the difference?

What does begingroup and endgroup mean?

When do these events get emitted and when are they generally used?

I've seen the documentation at: http://noflojs.org/documentation/components/#portevents

Would my assumption be correct to assume that attach and detach are for handling NoFlo UI cases eg changing the state of the components look?

Another assumption would be that connect gets fired every time before data is sent? Then data gets fired. Then disconnect? Seems a bit odd to me...

I'm completely in the dark when it comes to groups.

4

1 回答 1

4

attachdetach当 NoFlo 网络连接(或移除)一个套接字到端口时发生。因此,它们通常发生在网络启动时,在 IIP 被发送之前。

例外情况是当您使用Flowhub等工具实时编辑图表时。在这种情况下attach/detach可能在您连接或移除电线时发生。

大多数组件不需要关心附件事件。

connect发生在上游连接发送数据之前,并且disconnect当上游连接说它已经发送了它打算发送的所有内容时。所以实际上它们是传输事件的开始传输事件的结束。如果上游组件有新的一批数据要发送,它可能会connect在 a 之后再次选择。disconnect

data是实际包含有效载荷的数据包的事件。

begingroup并且endgroup是包含有关正在发送的数据的元数据的“括号 IP”。它们可用于创建包含数据包数据的树结构

例如,filesystem/ReadFile将文件内容作为data数据包发送,但文件名是通过括号 IP发送的,在实际文件内容周围使用begingroup/数据包。endgroup

noflo -groups库提供了许多组件,用于利用组信息进行同步、路由等。

于 2014-03-07T22:56:13.487 回答