Hello, One of the things that I love about text/gemini is how it's easy to parse, and being it line-based it's also really easy to stream it. When I started working on telescope, the idea of being able to stream content was present in the design of the parser from the first draft -- it also fit nicely with separation in multiple processes (one process does the fetching, another one the rendering, and messages are sent from one proc to the other.) But other than knowing from the code that it should work, I never played with this aspect of text/gemini. Fast forward various months, I've just watched the "Why gemini" video by Tomasino and I got an urge to build something with streaming text. I'm attaching a very, very simple CGI script that streams text/gemini to build an interactive chatroom. The idea is similar to the one presented by solderpunk in "A vision for gemini applications" gemini://gemini.circumlunar.space/users/solderpunk/gemlog/a-vision-for-gemi ni-applications.gmi and, frankly, I'm quite disappointed nobody has built something like this before. (or at least I haven't been able to find it. I know kensanata has made some experiments with a mush, but I haven't played with it (yet)) The idea is to provide two pages: one that accepts input via the response code 10 and appends to a file, the second is a literal `tail -f'. Simple, but it works, and it's immediate. As soon as someone sends something, all the clients reading from `tail -f' gets the message. (the various `tail -f' gets eventually killed by a SIGPIPE when the client closes the connection and the server closes the script stdout. It could take a while due to the buffering, but can be worked out. I don't know if servers are expected to kill the spawned scripts -- I don't recall anything from the RFC -- but I'm probably wrong. gmid anyway doesn't kill the scripts, it let UNIX do its things with signals. Feature or bug? dunno.) It doesn't require a client certificates, but uses the subject of it if provided. There's a check that can be de-commented to enforce the usage of client certificates. I'm hosting a demo at gemini://gemini.omarpolo.com/cgi/lets-chat but I don't promise to keep it online. It's a quick-n-dirty script (less than 50 lines of -hopefully- portable sh), probably filled with bugs, wrote only to be a demonstration. I don't want to moderate it if/when people write things. It's really easy to host it locally, for e.g. using gmid (disclaimer: I'm the author) $ gmid -x '*' . from the same directory where you saved the script. It seems to work with Telescope, Tinmop and Lagrange. Kristall and Amfora don't seem to support streaming, or maybe I have an old version. Elpher doesn't stream by design. I hope this inspires someone to build amazing things with the streaming capability of text/gemini. There are a lot of possibilities, for instance capsules like station could stream the feed, or the notification page; it could be better than clients continously refreshing the page. Think of it like some sort of "websockets" but for humans ;) Gemini clients could "ring" or use some other kind of mechanism to inform the user that more content is available in a page (for e.g. Telescope adds a `!' before the tab title.) Cheers, Omar Polo P.S.: this is also a partial reply to the talkat spec. I love seeing what creative things folks are building, and I really hope the best for mbays and their idea (if I got the paternity correctly :P), but I also like the idea of doing these sort of things over gemini. On one hand I don't want to push gemini over its boundaries, on the other I love doing that :)
---
Next in thread (2 of 12): 🗣️ Michael Lazar (lazar.michael22 (a) gmail.com)