Giter Club home page Giter Club logo

cs209a_chat's Introduction

CS209 ASS 2

worked by 11910507

Model

通信部分,采用server-client模型。 GUI部分,采用了javafx,爲了增加提示音的功能,還使用了javafx-media。

GUI

窗口分为上中下三个部分。

窗口的上部分是按钮,只有私人聊天和群组聊天两个按钮,功能已完全实现。

  • 私人聊天能够创建与某个在线用户的聊天,如果已存在聊天列表,则会消息窗口会跳转到对应的对话中;
  • 群组聊天能够创建与至少两个其他用户的在线用户聊提案,如果少于两个则无法创建,需要设置群组名,群组名为空无法创建。群组以群组名为唯一识别标识。

窗口的中部分是消息窗口,分爲左中右三個部分。

  • 左边显示的是消息列表chatList,为了方便测试,采用了当新用户加入后默认加入消息列表的设计,这样不需要点击私人聊天按钮,节约时间。实现了点击某个chat即可跳转到某个对话窗口的功能。
  • 中间显示为上下两部分。
    • 上边是chatContentList,消息的列表,会根据发送人,发送信息,逐行显示消息。
    • 下边是发送信息的输入框和send发送按钮(upload按钮实现),发送后会清空输入框,发送到当前对话窗口的对应chat。
  • 右边显示为上下两部分。
    • 上边维护一个users,表示实时在线用户
    • 下边维护一个groupUsreList, 表示当前群组的在线用户。

通信

通信采用server-client模型,使用socket进行通信,并使用了自己设计的若干报文,由于是作业且考虑到个人的时间不充足,所有的保文实现都类似于udp的形式,没有做任何的防止报文丢失的设计,同时也不对报文的内容进行任何检查,仅根据报文格式进行处理。

  • MSG one-to-one通信报文
  • GRP one-to-group通信报文
  • USER 用户登录和登出时,给其他用户发送报文
  • USERS 用户刚登陆时,提供用户列表,用于检测用户名是否重复。
  • SERVER 服务器状态信息报文,用于服务器进程停止时通知user。

功能要求

除了bonus以外的所有功能,都已经实现。

cs209a_chat's People

Contributors

dreamking60 avatar

Watchers

 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.