Chatter Reborn
Connell Reffo
overview
This project is a variation of a previous project, Chatter, re-implemented in the Gleam programming language. This version is essentially just the text chat aspect of Omegle (which no longer exists). It allows users to speed chat with random strangers in real-time.
why
I chose to re-implement this project in Gleam for the following reasions:
Learning functional programming was something I wanted to do for a while, and Gleam seemed like a good language to start with.
Type safety is very important to me when programing, and Gleam is a statically typed language unlike Erlang and Elixir.
Familiar syntax was also a factor in choosing Gleam. It has a syntax similar to Rust, which I have really enjoyed using.
Concurrency is a big part of the Erlang ecosystem, and I wanted to see how it was implemented in Gleam.
What is interesting about this approach, is that the webserver can scale to handle many users at once because of the way the Erlang VM handles concurrency. This is in contrast to single-threaded servers like those in Node.js which will hit a limit on the number of users they can handle at some point.
challenges
The concept of socket programming was not new to me at this point but I typically used libraries like Socket.io to handle the heavy lifting. Thus, in this version, I had to implement the socket server from scratch with the help of a small library called mist.
This was difficult at first because Gleam is a new language and the documentation is not as extensive as other languages. Additionally, at the time of writing this, mist had almost no documentation on how to use sockets for anything more than a basic echo server. I ended up reading the source code of the library to figure out how to use it.
images


