sergetymo / kaksik

Middleware library for creating apps for Gemini protocol on top of Deno runtime using TypeScript
MIT License
12 stars 2 forks source link

Support Titan #1

Open joakim opened 2 years ago

joakim commented 2 years ago

First of all, thanks for making such a nice Gemini server for Deno!

Have you considered adding support for Titan? I could give it a go, but I would need some tips or assistance to get started.

sergetymo commented 2 years ago

Hi @joakim! Thanks for a good suggestion and, more importantly, for bringing my attention back to Gemini-sphere. It's been a long break!

As you can see in feature roadmap, currently I have no plans to expand functionality to handle Titan protocol. The reason behind this is the fact that this project was intended to solve my basic needs in serving Gemini pages and small stateful apps in convenient for me express-like (or rather koa-like) way.

I believe that full Titan protocol is currently quite difficult to implement, due to hardcoded limitation to request size as per Gemini protocol specification, and the request-response approach I've used initially, instead of more flexible streaming one.

joakim commented 2 years ago

I looked at Application.ts and also found that it would have to be rewritten using streams. My first thought was to branch after reading the request's first line, with gemini:// requests being handled the same way as before and titan:// requests managed separately, but still using many of the existing classes.

Maybe I'll fork kaksik and give it a go one day. Would you be interested in a PR if such a change didn't have any regressions?

sergetymo commented 2 years ago

I'd be happy if you come up with generic protocol-agnostic connection handling approach using streams. This will allow to outsource handling of additional Titan's request contents to middleware, leaving Gemini as default option.

I can probably deal even with unreasonable amount of regressions within my 2.5 apps that are running on kaksik, due to its minimal API surface (it's only Application#use after all).

joakim commented 2 years ago

Hehe OK. I'm all for a protocol-agnostic approach!