Git Product home page Git Product logo

message-channel's Introduction

消息中心 message-channel

主要功能

1. 消息处理,生产消费
2. 聊天会话
3. 应用广播、通知推送

设计目标

1. worker无状态线性扩容
2. 消息不落盘中转
3. 单机长连接用户200w+
4. 单机并发用户30w+

架构图

架构图

主要模块

Master

1. worker注册、发现,平衡worker负载
2. 监控worker存活,性能指标
3. 聊天会话管理分配

Worker

1. 注册、性能指标上报Master 
2. topic消息转发
3. 通知提醒app
4. 聊天会话转发

APP

1. 生产topic消息
2. 聊天会话

Consumer

1. 消防topic消息 
2. 广播消息到APP

聊天会话

1. app-A发起聊天,在worker注册管理会话信息(id,app-A通道,A-worker地址)
2. worker向master注册会话(Id,A-worker地址)
3. app-B连接聊天Id,在worker注册
4. 先在master查找id,匹配B-worker与发起者是否一致,不一致返回307重定向到A-worker地址

会话流程图

会话流程图

测试代码查看:

com.stony.mc.session.WorkerServerTest

message-channel's People

Contributors

stonyshi avatar

Stargazers

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