3 ms·
> For example, the labstack echo framework in Go is one of my favorite frameworks, it does a lot of work for me. On the downside, I can't hijack HTTP connection
by camus2 9y ago
> For example, the labstack echo framework in Go is one of my favorite frameworks, it does a lot of work for me. On the downside, I can't hijack HTTP connections in the router,
This isn't a problem with "frameworks" but a problem with the library you specifically chose which is bad since it doesn't even fulfill your needs apparently. I wrote my own go http router, and I have no problem hijacking the connection and filter according to hosts, at all.
- zaarn 9y agoWriting a custom http router is kinda contra to the point of using a library, no? I don't want to bother with writing my own router and this was one of the few times I had problems. I think even if I wrote my own framework, I would eventually end up having to hack around it anyway when I inevitably need to do something the framework I wrote just fundamentally can't and I suggest this will be the case for your custom implementation too.
- heavenlyblue 9y agoSo don't evolve your project based on HTTP stack more than an HTTP stack may allow you to. Suddenly, you'd like to have real-time comm? Don't add WebSockets, simply because they fit right above the whole of your stack based on HTTP. Use TCP. There's a very gentle balance between using what you've already got and introducing a set of newer entities into the system; and sadly this is not always that clear, which one you should use.
- zaarn 9y agoYes and that's quite obvious. However, frameworks are stil a limiting fact in code. If I use a framework it won't let me do certain things. Which means I have to hack around or introduce newer entities/dependencies. A balance must be found, in one of the earlier examples, a quick hack was easier.