GithubHelp home page GithubHelp logo

wuzhou98 / gin-chat-demo Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cocainecong/gin-chat-demo

0.0 1.0 0.0 34 KB

gin+websocket+mongodb实现 IM 即时聊天系统

License: MIT License

Go 100.00%

gin-chat-demo's Introduction

gin-chat-demo

gin+websocket+mongodb实现 IM 即时聊天系统

这个项目是基于WebSocket + MongoDB + MySQL + Redis。 业务逻辑很简单,只是两人的聊天。

  • MySQL 用来存储用户基本信息
  • MongoDB 用来存放用户聊天信息
  • Redis 用来存储处理过期信息

项目结构

gin-chat-demo/
├── cache
├── conf
├── e
├── model
├── router
└── service
  • cache : 放置redis配置
  • conf : 放置配置文件
  • model : 数据库模型
  • pkg : 防止一些错误码
  • router : 路由模块
  • service :服务模块

项目功能

  • 两人通信
  • 在线、不在线应答
  • 查看历史聊天记录

项目运行

  • 下载依赖
go mod tidy
  • 执行
go run main.go

演示

  • 测试http连接

在这里插入图片描述

  • 进行ws连接,连接服务器

在这里插入图片描述

  • 当id=1上线,但是id=2没上线的时候发送消息

在这里插入图片描述

  • 当id=2上线之后

在这里插入图片描述

  • 再次发消息,就是在线应答了

在这里插入图片描述

  • 这边就实时接受到消息了

在这里插入图片描述

  • 获取历史信息

在这里插入图片描述

gin-chat-demo's People

Contributors

cocainecong avatar wuzhou98 avatar

Watchers

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