# Protobuf.js-related Changes
- protobuf.js can already parse and reflect upon service definitions. Can't we just reuse this functionality and pass the `Service` reflection object to the main API?
# Extend server API
- Add a method `Server.abortShutdown()` to complement `Server.tryShutdown()`
Reason: a server might decide it is overloaded and is not able to process more clients, but that state is transient and might be remedied in the future.
`Server.tryShutdown()` should not unbind from the server port. There should be a complementary method `Server.unbind()` to `Server.bind()`.
- Per client connect and disconnect hooks
The server API should provide per client connection and disconnection hooks, that are called with a server side `Connection` object (naming up for discussion).
Reason: A service might want to implement per connection state (authenticated, etc…), or simply keep track of connected clients (eg. for load statistics or connecting to per client backend services).
- The server side `Connection` object should provide a method to send `GOAWAY` and `PING` frames (and maybe other advanced functionality).
# API layering
Since I do not expect the current callback/streams based API to change anytime soon, it should be modified a little bit to enable an easier layering of different call styles on top of it. I am thinking here of promises, generators and rxjs style APIs.
For example, the object `ServerWriteableStream` conflates three distinct entities into one:
- The `request` object from the client.
- Metadata about the call (cancelled state, client metadata, peer info).
- A `Writable` stream for sending responses and completing/aborting the call.
If these were provided as separate objects to the handler function, different APIs could be layered more cleanly on top of it. For rxjs for example, a `ServerWriteableStream` could be driven from an `Observer` of an `Observable` provided from a higher level API, while the request and metadata objects could be passed up unmodified.
Best,
André