DevChat

DevChat is a chat-based program - quite similar to other communication applications like Discord and Slack - that can be used in the computer's terminal. Clients have the ability to create public and password-protected channels, view available channels, & join other channels on the server to chat with other users.

Motivation

One of my favorite classes that I've taken at UC Berkeley was CS168 - Introduction to the Internet: Architecture and Protocols. In the class we went over core networking concepts, such as TCP, routing algorithms, and port forwarding. This project served as a way to help solidify my knowledge of sockets & the server/client relationship, and apply that knowledge in a practical application.

Implementation

My implementation of DevChat revolves around two main files: the client file and the server file. The client file deals with connecting to the server, and the sending & receiving of messages. The server file handles those messages and determines what to do with them, such as creating a new channel or moving a client to another channel. Another utility file is used to hold any error or feedback message that the server might send to clients to diagnose problems or alert them of changes.

When a client first connected to the server, they're greeted with a friendly welcome message. They can then perform a number of actions:

  • /list displays all of the available channels
  • /join {channel} {password} allows the client to join a specified channel, with the option of entering a password if the channel is password protected
  • /create {channel} {password} gives the client the option to create a public or password protected channel
  • /changeName {new name} enables the client to change their username, should their current one already be taken
  • /whisper {name} lets the client send a private message to someone else on the server, regardless of what channel they're in

Here's a view of a sample interaction between two clients on DevChat:

The source code for this project can be found on my GitHub, if you'd like to check out or try using my DevChat program.

Conclusion

I really enjoyed working on this project and it greatly contributed to my enjoyment of CS168. Working with sockets in python quickly helped me soldify my practical knowledge, as I had hoped it would. Since I often use Discord to talk with friends, I really got into the development of DevChat, and I kept thinking of other cool features I could add to the program to improve it's usability. While this was just a small part of my introduction to networking, it definitely had a huge impact on my interest in that field.