$ man tshabbic.projects.tinychat
TINYCHAT(8)Distributed ChatroomTINYCHAT(8)
Name

tinychat -- distributed chatroom

Description

[See the Source Code!]


TinyChat is a fault-tolerant, multi-room chat application built entirely on Erlang's actor model; there are no locks, nor shared state(s), just processes talking to each other through message passing. Four process types cooperate under a strict request/response protocol: a server that arbitrates nicknames and chatroom discovery system-wide, chatroom processes that independently own their membership and message history, client processes that bridge user intent to the wire protocol, and a GUI layer (given to us) that renders it all. Joining a room, sending a message, or renaming yourself each triggers a defined multi-hop handshake across these actors -- client asks server, server may spawn or locate a chatroom, chatroom acknowledges and hands back state, client relays the result to the GUI. I implemented the client, server, and chatroom logic from a stubbed skeleton: room registration, nickname collision handling, message broadcast to all-but-sender, and clean teardown on quit -- all without ever generating a new reference ID mid-protocol, since correctness here depends on every actor agreeing on the same conversation.

Usage

To compile and run:

$ make
$ erl main.erl
1> main:start(N) # where N is the number of initially desired clients
# gui:start_gui() can be used during runtime to spawn client windows during runtime

Client Commands

/join #<chat_room_name>


Joins the chatroom with the name "chat_room_name"

/leave

Leaves the chatroom whose tab is currently active/open

/leave #<chat_room_name>


Attempts to leave the specified chat room

/nick <new_nickname>


Changes the nickname of the current window to the specified new nickname, if not already taken. First character must be lowercase

/quit

Close that user's GUI and has that client exit; server and chatrooms stay running

<string of text>


Sends the specified message to the chatroom whose tab is active/open

Bugs

Numerous with the GUI itself; none of which my partner and I were responsible for.

History

This project was completed during the Fall 2024 Semester for CS 511 - Concurrent Programming @ Stevens Institute of Technology.