Initially, I thought that my next step would be to write the code to handle more than a single connection at a time, but I decided that this isn’t the natural next step. It would be better to build the API and abstractions that are required to use this network protocol before committing to an actual implementation. I took a peek at what is available, and it looks like we have the following options:
Thread per connection – obviously out.
select() /pool() – allow to have a single thread manage multiple connections, but require a lot of state management.
libuv – or similar, that handle all of those details for me.
Regardless of what I’ll end up in the end, I think that the externally facing API is always going to be the same, so I’m going to focus on that. Right now we have: