Chatting is a simple online-chat application, based on JavaFX and Socket. In this assignment, you will need to implement a WeChat like program, but much simpler.
Click the use template to create a fork of this template - to avoid potential plagiarism dispute, please be sure that your repository is made private before the deadline.
You need to then clone your fork into local machine. You can then open the whole folder as a project in your IDE - it will recognize the Maven structure and automatically configure the project.
We will define the commonly used constants and models in the chatting-common
model,
which is the dependency of chatting-client
and chatting-server
.
This design is a common practice in many large projects. But it is not mandatory for you to follow this architecture. You can move the model codes to other places if you want.
Now, the first thing you need to do is to install the parent pom into the local maven repository.
mvn install
If you are a Windows user who has not configured Maven environment variables, you can run this command in IDEA by several ways as below:
- double click the Ctrl key in IDEA to bring up a "Run Anything" pop-up window, then enter the command
- click the "Execute Maven Goal" button on the top of Maven side bar, then enter the command
- simply click on the "install" option in the "Lifecycle" folder of Maven side bar
Note that each time after you modified the codes in chatting-common
, you need to reinstall
the subproject -- you can think about why.
mvn install -pl chatting-common
As our client will try to connect to the server socket when starting-up, you need to run the server before starting one or more clients.
Please find the Main
class under the chatting-server
model, implement your ServerSocket
,
and run the main
method.
If you are using JDK 1.8 with JavaFX bundled, you may find the Main
class under the chatting-client
model,
and run the main
method to start a client.
Note that you can start multiple clients by clicking the run button several times.
If you are using JDK in any higher version, please use the javafx
plugin to run the client.
mvn javafx:run -pl chatting-client
Alternatively, you can find the goal in the plugin list, and click on it:
- Server & Client (70 pt)
- JavaFX GUI (15 pt)
- Exception handling (15 pt)
- Bonus (12 pt)
For more details, please refer to the assignment description.
As this project is Maven managed, it's easy to introduce dependencies and build plugins. This template already added some dependencies that may help you finish this assignment, you can search their documents and try figuring out how these dependencies could be helpful, but it's not necessary to use them. You may also introduce some other dependencies, but ask the teacher or SA before doing so.
If there's anything ambiguous about the document or the instruction above, feel free to open an issue and ask. Your question may also help others to better understand this assignment ๐ฅ
This project is licensed under the MIT License - see the LICENSE file for details.