As Phoebe 2 is based on a streaming server framework, I can now implement a Gemini based chat server!
Here’s a screenshot. Explanation below!
In the top left corner you see the Phoebe server with debug log level. It shows user kensanata joined the chat, how Alex joined the chat, and how one of the chat members sent a URL with a text message.
In the top right corner you see user kensanata connecting with my command line client, using my Astrobotany certificate from the Elpher directory. This user was the first user in the chat and so they see “You are the only one.”
In the bottom left corner you see user Alex connecting with my command line client, using my alex certificate from the Elpher directory. This user was the second user in the chat so they see “Other chat members: kensanata”. At this point, user kensanata in the top right corner sees “Alex joined”.
In the bottom right orner you see user Alex connecting a second time, but this time not to listen but to say something in response to a 10 prompt: “This is a test”. At this point, user kensanata in the top right corner sees “Alex: This is a test.”
🎉🚀🚀
#Gemini #Phoebe
(Please contact me if you want to remove your comment.)
⁂
It seems like my command-line Gemini client isn’t very good at this: it hangs up after a while. Lagrange, on the other hand, seems to work just fine! Hm... Ah, there it is. It needs an inactivity timeout increase and there are two different timeouts: one for the connection establishment and one for inactivity, and I was setting the wrong one. But now it’s fixed.
Here’s how I start it, from the Phoebe work-directory:
script/gemini \ --cert=/home/alex/.emacs.d/elpher-certificates/alex.crt \ --key=/home/alex/.emacs.d/elpher-certificates/alex.key \ gemini://transjovian.org/do/chat/listen
And then when I want to say something:
script/gemini \ --cert=/home/alex/.emacs.d/elpher-certificates/alex.crt \ --key=/home/alex/.emacs.d/elpher-certificates/alex.key \ gemini://transjovian.org/do/chat/say?Hello
Or point a regular client at the URL:
gemini://transjovian.org/do/chat/say
If you’re a programmer interested in this, you could of course write your own specialized chat client. 🙂
– 2020-12-04 15:15 UTC
---
Now we can reimplement IRC, badly! 😂
I am already wondering: what about spam? Harassment? Moderation? Blocking?
– 2020-12-04 18:19 UTC
---
There’s now a chat client that does both at the same time: forks and the parent connects to the “listen” URL and the child loops a prompt and sends stuff to the “say” URL. Currently the only issue I have is that sometimes the prompt gets messed up because I don’t know my way around the terminal control sequences. ESC 7, ESC 8, ESC [ 1 G, gaaaaah. But it’s good enough to go to bed, now. 😀
https://alexschroeder.ch/cgit/phoebe/tree/script/gemini-chat
Also, I think clients disconnecting aren’t registered by the server. So now there about ten Alex chat members and they’re all disconnected. Too bad!
– 2020-12-04 22:30 UTC
---
I think it’s really working! From the manual page of gemini-chat…
First, generate your client certificate for as many or as few days as you like:
openssl req -new -x509 -newkey ec -subj "/CN=Alex" \ -pkeyopt ec_paramgen_curve:prime256v1 -days 100 \ -nodes -out alex-cert.pem -keyout alex-key.pem
Then start the program:
gemini-chat --cert=alex-cert.pem --key=alex-key.pem \ --listen=gemini://transjovian.org/do/chat/listen \ --say=gemini://transjovian.org/do/chat/say \
Or, if you use a client like Lagrange, just open two tabs:
gemini://transjovian.org/do/chat/listen
gemini://transjovian.org/do/chat/say
Currently I’m using the client certificate’s common name as your name on the channel. I think this makes more sense than using the fingerprint because we humans are confused when we see a bunch of users called Alex, each representing a different person.
– Alex 2020-12-05
---
Sending a timestampe in the HH:MM UTC format as “keep alive” every five minutes.
– Alex 2020-12-05 09:57 UTC
---
If somebody knows how to write a nice terminal application that prints input to stdout while keep a prompt with readline at the bottom going, let me know. Right now, that doesn’t work.
– Alex 2020-12-05 10:02 UTC