Building a chat tool with a simple command-line interface which supports multiple chat rooms.
Building a chat tool with a simple command-line interface which supports multiple chat rooms.
Most often than not, we run heavy GUI-based applications for the simplest of tasks. One such simple task is instant messaging or chatting. Chat tools enable users to start chatting with other users in real-time. It also enables users to transmit text messages, images, videos, and hyperlinks.
In this project, we aim to build a simple command-line chat tool which is easy to use and also has a very minimal interface.
socket
and threading
modules in Python.The diagram below shows the basic architecture of the chat tool. The server should be connected to all the clients directly but should be able to categorize them into their respective chat rooms and broadcast messages only to the sender's chat room.
For example: If Client A sends a message, the message should only be broadcasted to clients B and C and not any other clients.
The diagram below shows a high level approach used to build and develop the chat tool.
The desired end result of the project is like this:
Building a chat tool with a simple command-line interface which supports multiple chat rooms.
Most often than not, we run heavy GUI-based applications for the simplest of tasks. One such simple task is instant messaging or chatting. Chat tools enable users to start chatting with other users in real-time. It also enables users to transmit text messages, images, videos, and hyperlinks.
In this project, we aim to build a simple command-line chat tool which is easy to use and also has a very minimal interface.
socket
and threading
modules in Python.The diagram below shows the basic architecture of the chat tool. The server should be connected to all the clients directly but should be able to categorize them into their respective chat rooms and broadcast messages only to the sender's chat room.
For example: If Client A sends a message, the message should only be broadcasted to clients B and C and not any other clients.
The diagram below shows a high level approach used to build and develop the chat tool.
The desired end result of the project is like this:
A thread is a light-weight smallest part of a process that can run concurrently with the other parts(other threads) of the same process. Threads are independent because they all have separate paths of execution. All threads of a process share the common memory. The process of executing multiple threads simultaneously is known as multithreading. (definition source: beginnersbook.com)
In this milestone, you need to understand the concepts of multithreading and learn how to implement multithreading in Python.
threading
module in Python.You should be able to understand how to implement multithreading in Python using the threading
library.
Sockets allow communication between two different processes on the same or different machines. To be more precise, it's a way to talk to other computers using standard Unix file descriptors. In Unix, every I/O action is done by writing or reading a file descriptor. A file descriptor is just an integer associated with an open file and it can be a network connection, a text file, a terminal, or something else. To a programmer, a socket looks and behaves much like a low-level file descriptor. This is because commands such as read() and write() work with sockets in the same way they do with files and pipes. (definition source: tutorialspoint.com)
In this milestone, you have to understand socket programming and have to implement a simple client-server program and establish a connection between the client and server.
socket
module in Python.socket
module.
You should be able to implement a simple client-server program in Python using the socket
module.
In this milestone you'll be developing a simple chat application. Extend the previously built client-server program to allow server to accept connections from multiple clients. Also, allow the server the to accept messages from all the client and broadcast the messages to all the clients.
You should be able to achieve the following:
Extend the functionality of the chat tool so it supports multiple chat rooms. The server should be able to manage multiple users in multiple chat rooms at a given time.
You should be able to achieve the following:
As the basic implementation is all done, for all the curious cats out there, these are some of the line items which can be implemented to spice up the existing functionality.
[NOTE: This is not a mandatory milestone.]
dict
or objects of a class) can be created with a specified format and saved using Python's pickle
module.The chat history for all the chat rooms should be stored in files or databases.
As the basic implementation is all done, for all the curious cats out there, these are some of the line items which can be implemented to spice up the existing functionality.
[NOTE: This is not a mandatory milestone.] [P. S. : This milestone is independent of milestone 5. Meaning, you can skip milestone 5 and implement this one if you want to.]