Code Monkey home page Code Monkey logo

easyim-server's Introduction

#EasyIM-Server

EasyIM是一个移动即时通讯应用。是我的本科毕业设计。

因为实习占用了大四的大部分时间,导致EasyIM只完成了部分功能便参与答辩。虽然最终侥幸过了毕设答辩,但效果与自己期望的相去甚远。

开始工作后,有比较多的空闲时间,我打算慢慢完善该项目,并将近期所学习的一些新技术应用到该项目中。

简述

该项目分为两部分:

EasyIM-Server主要完成一下功能:

  • 用户基础功能
  • 好友功能
  • 点对点的消息发送功能
  • 离线消息功能

目录结构

.
├── README.md
├── pom.xml 
├── sql 数据库文件
└── src 
    ├── main/java/me/xiezefan/easyim/server
    │   │   ├── common --- 业务公共类
    │   │   ├── dao ------ 数据持久化层
    │   │   ├── filter --- 权限过滤
    │   │   ├── model ---- 实体类
    │   │   ├── resource - Restful API层
    │   │   ├── service -- 逻辑业务层
    │   │   ├── util ----- 工具类
    │   │   └── web ------ Web相关
    │   ├── resources
    │   │   ├── applicationContext.xml
    │   │   ├── log4j.properties
    │   │   ├── mapper ---  MyBatis映射文件
    │   │   └── mybatis-configuration.xml
    │   └── webapp/WEB-INF  
    └── test

快速运行

前置条件:

  • 安装Mysql
  • 安装Maven

运行步骤:

  1. 创建数据库easyim,并导入sql/easy_im_v1.sql
  2. 修改src/main/resources/applicationContext.xml中mysql的配置
  3. EasyIM-Server根目录执行maven jetty:run
  4. 使用Post请求localhost:8080/users/register确定服务是否正常启动

框架与技术

EasyIM Server 主要为EasyIM客户端提供Restful API。 主要使用了以下框架及第三方服务:

  • Jersey 主要提供Restful支持
  • Jetty Server运行的容器(亦支持Tomcat)
  • Spring 提供依赖注入
  • MyBatis 数据库映射框架
  • MySQL
  • RabbitMQ 主要做消息发送队列用(暂未实行)
  • 七牛云 用户发送的图片,语言存储服务
  • JPush 提供最核心的消息推送支持

API

Authoirzation

EasyIM使用Basic认证, 除了用户登录,注册接口外,其余接口都需要将用户名username,密码password依照以下规制生成authcode,在每次API请求时,附带在headers中的Authorization中。

authcode = "Basic " + Base64(username:md5(password))

(一种更合理的设计应该是,第一次鉴权后,生成一个有一定时限的access_token来作为authcode)

User 用户接口

POST ~/users/login 用户登录
POST ~/users/register 用户注册
GET ~/users 获取用户列表
GET ~/users/search 用户搜索 GET ~/users/{user_id} 获取指定用户的信息
PUT ~/users/self 更新个人信息

Friendship 好友接口

POST ~/friends 添加好友关系
DELETE ~/friends/{friend_id} 删除指定好友关系
GET ~/friends 获取当前用户的好友列表

Message 消息发送接口

POST /mesasges/send 发送消息(加好友,文本,图文)
GET /messages/offline 获取离线消息
PUT /messages/status 批量更新消息状态(主要为标记离线/未读消息)
PUT /messages/status/{mid} 更新指定消息状态

easyim-server's People

Contributors

xiezefan avatar

Watchers

James Cloos avatar Charlie 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.