Any Membrane program can emit events on their nodes and subscribe to events on nodes of other programs. In the Schema section we gave the example of a closed on a PullRequest node type.
As another example, let’s say you have a program that handles webhooks. A node in your program could emit a webhookReceived event, and another program could subscribe to that event.
Emitting events
Here we are emitting that webhookReceived event from a program’s root node.
Programs can subscribe an action to handle an event. When an event is emitted, the action will be invoked with an additional parameter called event.
Here we are subscribing a program to the webhookReceived event with a doSomething action as its handler. Note that this subscribing program would have the emitting program as a connection.