thekid/rfc — Issue #65: RFC 0065: Server Protocol API
Author: thekid
Created: 2011-10-09 14:49:32+00:00
State: open

Scope of Change
====
A server will have a protocol implementation which will take care of
reading and writing data from and to the accept()'ed sockets.

Rationale
====
Flexibility.

Functionality
====

Setting the protocol implementation
----

```php
setProtocol(new EascProtocol());
$server->init();
$server->service();
$server->shutdown();
}
?>
```

Protocol interface
----
Stripped of API-Doc for readability, see patch for details:

```php

```

BC
~~
For BC reasons, Server::addListener() is kept. It will create an instance
of ListenerWrapperProtocol which will simulate the old listener API.

Security considerations
====
n/a

Speed impact
====
n/a

Dependencies
====
- New Protocol interface.
- Some BC protocol implementation

Related documents
====
- http://xp-framework.net/rfc/contrib/rfc0065.diff
Patch implementing this RFC

Comments
====
- friebe, Fri Jul 7 11:26:16 CEST 2006
Not sure about the name of this reader. SocketReader seems a bit too
generic. ServerDataReader? And with dataFrom() or readDataFrom()
instead of readData()?

- gelli, Fri Jul 7 11:58:40 CEST 2006
As of the current state, which is that this new api will always read from
sockets, i think SocketReader as interface name is not too generic but
ServerDataReader is. Addressing the methods name i'd prefer readFrom($socket)
as it's literally a little bit more "readable"

- friebe, Sun Jul 9 10:11:24 2006
More thoughts on naming:
* Reads data from client => ClientDataReader::readFrom($sock)
* Extracts data from socket => DataExtractor::dataFrom($sock)
* Interprets data from socket => DataInterpreter::dataFrom($sock)
* Implements reading => (Server)(Data)Read(ing|er)Implementation::readFrom($sock)

- kiesel, Wed Jul 12 11:42:10 CEST 2006
To fully implement a client/server protocol, we also need a writer,
so this proposal is only half of the "work".

- friebe, Thu Jul 13 17:02:47 CEST 2006
Revamped this completely!

- friebe, Fri Aug 18 16:47:52 CEST 2006
Protocol -> ServerProtocol, Protocol is a very generic name I'd like
to keep for other - future - purposes:)