Giter VIP home page Giter VIP logo

chat's Introduction

chat(聊天)

Build Status

设计理念

 EndPoint:  消息收发点(对应到一个玩家的聊天,或者一个联盟聊天) 
 PubSub: 对任意EndPoint进行发布,订阅

聊天服务器并不关心一个EndPoint对应的是一个玩家,还是一个联盟,只需要一个独立的id(snowflake-id)。
通常在玩家注册的时候,会创建一个EndPoint,创建一个联盟的时候,也会创建一个EndPoint。
玩家登陆后,会订阅到自己的私人EndPoint和所属联盟的EndPoint,以便接受实时聊天消息。
CHAT会保留一定数量的消息在内存中(默认128条),这个消息队列会定期持久化到本地磁盘,以便重启时候加载。
持久化采用boltdb,零配置, 数据存储在 /data, docker启动的时候,需要绑定到外部目录。

基于PubSub的聊天服务器,优点在于可以通过多个途径同时访问到同一个EndPoint, 例如:

  1. 游戏内
  2. 游戏提供的离线聊天工具
  3. 提供给XMPP网关

使用

参考测试用例以及chat.proto文件

安装

参考Dockerfile

环境变量

NSQD_HOST: eg : http://172.17.42.1:4151

chat's People

Contributors

johnnyluo586 avatar xtaci avatar

Watchers

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