The Perl Advent Calendar needs more articles for 2022. Submit your idea today!

NAME

App::Phoebe::Chat - add a Gemini-based chat room for every Phoebe wiki space

DESCRIPTION

For every wiki space, this creates a Gemini-based chat room. Every chat client needs two URLs, the "listen" and the "say" URL.

The Listen URL is where you need to stream: as people say things in the room, these messages get streamed in one endless Gemini document. You might have to set an appropriate timeout period for your connection for this to work. 1h, perhaps?

The URL will look something like this: gemini://localhost/do/chat/listen or gemini://localhost/space/do/chat/listen

The Say URL is where you post things you want to say: point your client at the URL, it prompts your for something to say, and once you do, it redirects you to the same URL again, so you can keep saying things.

The URL will look something like this: gemini://localhost/do/chat/say or gemini://localhost/space/do/chat/say

Your chat nickname is the client certificate's common name. One way to create a client certificate that's valid for five years with an appropriate common name:

    openssl req -new -x509 -newkey ec \
    -pkeyopt ec_paramgen_curve:prime256v1 \
    -subj '/CN=Alex' \
    -days 1825 -nodes -out cert.pem -keyout key.pem

There is no configuration. Simply add it to your config file:

    use App::Phoebe::Chat;

As a user, first connect using a client that can stream:

    gemini --cert_file=cert.pem --key_file=key.pem \
      gemini://localhost/do/chat/listen

Then connect with a client that let's you post what you type:

    gemini-chat --cert_file=cert.pem --key_file=key.pem \
      "gemini://localhost/do/chat/say"