GithubHelp home page GithubHelp logo

xavierwoo97 / chatserver Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 3.32 MB

本项目使用开源muduo网络库实现网络模块,配合nginx和redis发布订阅功能实现了一个简单的集群聊天服务器。该服务器支持一对一聊天,群聊,离线消息查看等功能。

License: MIT License

CMake 0.57% Shell 0.01% C++ 97.00% Makefile 2.42%

chatserver's Introduction

chatserver

本项目使用开源muduo网络库实现网络模块,配合nginx和redis发布订阅功能实现了一个简单的集群聊天服务器。该服务器支持一对一聊天,群聊,离线消息查看等功能。

快速上手

本项目基于一下环境开发:
* ubuntu 20.04
* muduo 
* nginx 1.12.2
* mysql 8.0.29-0ubuntu0.20.04.3
* redis-server
* CMake
autobuild.sh为一键式编译脚本,使用者需自行更改src/server/db/db.cpp中关于mysql的配置信息,以及配置nginx负载均衡.

MySQL 表设计

【user表】

字段名称 字段类型 字段说明 约束
id INT 用户id PRIMARY_KEY、AUTO_INCREMENT
name VARCHAR(50) 用户名 NOT NULL, UNIQUE
password VARCHAR(50) 用户密码 NOT NULL
state ENUM(‘online', 'offline') 当前登录状态 DEFAULT 'offline'

【Frined表】

字段名称 字段类型 字段说明 约束
userid INT 用户id NOT NULL、 联合主键
friendid INT 好友id NOT NULL、 联合主键

【AllGroup表】

字段名称 字段类型 字段说明 约束
id INT 组id PRIMARY_KEY、AUTO_INCREMENT
groupname VARCHAR(50) 组名称 NOT NULL,UNIQUE
gruopdesc VARCHAR(200) 组功能描述 DEFAULT ' '

【GroupUser表】

字段名称 字段类型 字段说明 约束
groupid INT 组id NOT NULL、联合主键
userid INT 组员id NOT NULL、联合主键
grouprole ENUM('creator', 'normal') 组内角色 DEFAULT ‘normal’

【OfflineMessage表】

字段名称 字段类型 字段说明 约束
userid INT 用户id NOT NULL
message VARCHAR(500) 离线消息(存储Json字符串) NOT NULL

chatserver's People

Contributors

xavierwoo97 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.