Giter Club home page Giter Club logo

java-chat's Introduction

java-client

A console-based chat client & server, built using strong TDD throughout. It uses Java 8, JUnit and Hamcrest matchers, but has not other dependencies.

This is a teaching application designed to show how real-world applications can be structured. There are a number of areas in which the application can be extended, and you are encouraged to do so in your own fork. Suggestions for improvements are listed below.

Prerequisities

  • JDK 8
  • Maven

How to build

Run mvn package to compile, run tests and package the application. The jar file will be output in target and named chat-1.0.jar.

Starting a chat server

  1. First build the application and then change to the target directory. If you are in the project root then you can do this with cd target.

  2. Run the following command.

java -jar chat-1.0.jar server <port number>

If you do not specify a port number the system uses a default of 3000. If the port is already in use, you will see an "Address already in use" error.

Joining the chat room

  1. First build the application and then change to the target directory. If you are in the project root then you can do this with cd target.

  2. Run the following command.

java -jar chat-1.0.jar client <address> <port number> <username>

If the name is already in use you will see an error.

Suggested improvements

Simple

  • Helpful stdout messages for both client and server
  • Alert users when someone registers
  • Disconnect message and alert when a user leaves
  • Ping message that auto-disconnects after a period of silence

More involved

  • Add support for multiple rooms
  • Add a moderator role that has the ability to kick users
  • Add support for password-protected user accounts
  • Allow communication via websockets with a web frontend
  • Client command to list all users

Contributing

Contributions (of all forms) are most welcome. Please submit pull requests in the normal fashion or contact me directly.

java-chat's People

Contributors

dirv avatar

Watchers

James Cloos avatar rajee avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.