Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
39 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
# [Supe](../README.md) > Core Components | ||
|
||
## [Supervision](core-components/supervision.md) | ||
## [Signal](core-components/signal.md) | ||
## [Noticeboard](core-components/noticeboard.md) | ||
## [Mail](core-components/mail.md) | ||
## [Supervision](core-components/supervision.md) | ||
## Signal | ||
## Hook | ||
## Hook |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# [Supe](../../README.md) > [Core Components](../core-components.md) > Signal | ||
|
||
## Signal | ||
|
||
### About | ||
Signal is a simple lightweight way to send a message from one entity ( citizen, supervisor ) to another. | ||
|
||
Signal is Supe's lowest level inter-entity communication tool. While lightweight and fast, it lacks enough features to use directly for all inter-entity communication. No built-in mechanism for a signal's recipient to reply the sender. | ||
|
||
Despite these constraints, signal is a powerful solid building block for fancier messaging features and patterns. Supervision, mail and noticeboard all use signal to coordinate between two entities. | ||
|
||
If you're building custom or shareable Supe addons, Signal makes sense. Otherwise, you might get more value looking at communication tools that build on Signal and provide additional guarantees. | ||
|
||
For example: | ||
- Noticeboard is a signal that gets broadcasted to all entities, rather than a specific one. | ||
- Mail is signal that persists in the mailbox til the citizen processes and confirms it has been. | ||
|
||
`supervisor` | ||
```js | ||
var supe = require('supe')(), | ||
signal_recipient = 'citizen-kane', | ||
citizen = supe.get( signal_recipient ); | ||
|
||
citizen.signal.send( 'HELLO-CITIZEN' ) | ||
``` | ||
|
||
`citizen` | ||
```js | ||
var citizen = require('supe'); | ||
|
||
// to fellow citizen | ||
citizen.signal.send({ to: 'citizen-kane' }, 'HELLO-FELLOW-CITIZEN' ); | ||
|
||
// to supervisor | ||
citizen.signal.send( 'HELLO-SUPE' ); | ||
``` |