Introduce “socket wrapper”
Hywan opened this issue · 3 comments
Hello !
I try to implement a socket factory PR but get some issues with it...
First, there is no .gitignore in the project, is it normal ? I know it's an external lib but it's very confusing to avoid adding / commiting some files during work...
Second, I start thinking about interfaces, then thinking about standard PHP stream wrappers... I find that the hoaproject/Stream
lib is already able to handle stream wrappers. The ws://
& wss://
protocols are just specific cases for socket stream. I think it can be interesting to use that feature to handle them.
I also saw the comment from @flip111 in the hoaproject/Websocket#44 issue. For the moment I'm a little confused about where to start the PR...
Then I'm also thinking about the factories for TCP & UDP. They are not really needed because they already are transport and there is no need to be wrapped inside a different logic.
I think that we "only" need to add a transposition logic which allow to map Application layers to Transport layers.
Yup, maybe TCP and UDP factories are not needed.
I guess we can skip the comment of @flip111 for the moment :-). You did a great job by starting by Hoa\Socket
.
Yes, there is no .gitignore
file. We are writing the contributor guide (hoaproject/Literature#23), maybe this is something to precise or add on all libraries.
I thought about PHP stream wrappers but they address a whole other problem. They provide interface to act on files, here this is just about a factory to transport an “application layer” to a “transport layer”. Also, why these names? “Application” and “transport” sound very correct but why layer? Maybe we could also rename Hoa\Socket\Socket
, I don't know, but it could introduce a BC break.
Done.