-
Notifications
You must be signed in to change notification settings - Fork 28
Description
To understand the target architecture better, it would be good to have responsibilities of main entities documented somewhere, at least the initial vision.
Trying to understand #74, I read the discussion here (in addition to looking over the current codebase), and this is what I understand from it:
Wire
is responsible for maintaining connection over time, which involves:
- Passing bytes back and forth.
- Interpreting at least some headers, e.g.
Connection
andKeep-Alive
, and therefore parsing at least a part of the byte stream. - Possibly reconnecting if server closes the connection for any reason?
Response
is responsible for reading the byte stream and closing the Wire
(only if it's the last response in the "Keep-Alive" exchange series?)
Request
is responsible for packaging request headers and body, but not sending them to server - Response
does that (awkward?) via the Wire
.
Is that correct?
What about Wire
upgrades? As I understood from here, Wire
should be dumb and not be able to upgrade itself, but that discussion happened before the one I mentioned earlier, from which I understood Wire
needs to be able to understand at least some headers, so in principle it could also be responsible for upgrading itself? Not sure how good of an idea this is.
In any case, it would be good to have a clear list of responsibilities for Request
, Response
and Wire
, and also a few code snippets of approximate intended usage, similar to here and here (they were quite useful for me in trying to understand all of this).