API consists of 2 parts: EventEmitter-like events passing with .on/.emit
and request/response
with .request/.respondTo
.
EventEmitter one is quite obvious - EventEmitter over the wire/processes.
Request/Response one allows to register a request handler for a particular request type instead of using events to implement same functionality.
Result should be anything else but undefined
(print warning otherwise) - Promises are awaited
to be resolved and plain values are sent as is. There is one constraint - value should be
serializable via JSON.stringify
.
- is that a good idea?
- is that worth doing the way described here?
- how to handle binary data while keeping ergonomics nice?
- should we handle binary data at all?