chookchat/server
2024-12-04 13:11:36 +11:00
..
resources Add Chookpen config file 2024-12-04 08:39:58 +11:00
src/main Update README.md 2024-12-04 13:11:36 +11:00
build.gradle.kts Clean up code, support JSON 2024-11-23 18:12:07 +11:00
chookchat.config Update README.md 2024-12-04 13:11:36 +11:00
README.md Update README.md 2024-12-04 13:11:36 +11:00
settings.gradle.kts Add file upload support 2024-11-25 14:50:03 +11:00

Chookchat Server

This is the code for Chookchat's server program. The server program:

  • Starts a server on port 7070

  • Hosts the web client files (index.html at the root)

  • Adjusts index.html based on your config file (a backup index.html is still avaliable at localhost:7070/index.html)

  • Handles user signups

  • Opens a websocket allowing for flexible user input

  • Handles file uploads

Note: Chookchat does not support HTTPS natively. We recommend the usage of a reverse proxy like Caddy (caddyserver.com) to enable HTTPS on your website, as well as a firewall to block HTTP connections.

Server Configuration

Chookchat looks for a chookchat.config file in the directory where you start Chookchat. An example is provided in this directory. Your file must look like the following:

address:localhost;port:7070;security:false;serviceName:Chookchat;

Address: Where your server is hosted (a domain or IP address usually) Port: Your server's port (default 7070, 443 if you route it through Caddy with HTTPS) Security: Whether or not to use WSS/HTTPS (either true or false) ServiceName: What your server's name comes up as.

API Documentation

Chookchat uses websockets to send and recieve messages. Each websocket request (except pinging and ponging) contains JSON to show what kind of data we are sending, what user is sending it (and token while being sent to the server), and the actual message content. A chookchat websocket message to the server looks like this:

{
    "type": "message",
    "username": "max",
    "token": "(hash of password)",
    "content": "dongus"
}

And a message from the server would look like this (it's the same without the token):

{
    "type": "message",
    "username": "max",
    "content": "dongus"
}

The server will send a ping every five seconds (without JSON) to stop the connection from timing out. When you recieve this, send back a pong.

Message Types

message: A message. Not much going on. It's recommended to display it like ${username}: ${content}

call: A link to a Jitsi call. Treat this how you'd like.

file: A file sent by a user. For now, it appears as if the system user has sent the file, so in a client send a message describing who's uploaded the file shortly after sending the file.

connect: A user joining the room. If this is not sent by the system user, ignore.

users: A list of users currently in the room, seperated by ", ". In order of who joined first. If this is not sent by the system user, ignore.