Hacker News new | ask | show | jobs
by austin-cheney 217 days ago
I don’t like either so I wrote my own solution.

What killed Apache for me were the complexity of various rules and how challenging it is to define a proxy for a WebSocket connection. NGINX is better but still not great.

For me anything can be connected to anything else easily and quickly. A network connection, a socket, is a pipe containing a full duplex stream. So, just pipe one socket to another, and vice versa, and you have a very low level proxy. The rules to define such for a users customization is just as simple as what should go where.

Knowing all of that, and that HTTP is not full duplex, I serve HTTP and WebSockets from the same port with a preference for WebSockets by default. I can also pipe other streams to sockets for lower CPU overhead. I have not tested if my server is faster and less CPU overhead than NGINX yet, but it does concurrency very well.