Code Monkey home page Code Monkey logo

appmsgsrv's Introduction

应用消息服务 Build Status

gopush-cluster 基础上做了扩展,加入了用户、群、组织机构等应用元素。

特性

  • 会话推送
  • 用户-用户、用户-群、应用-用户推送
  • iOS 通知
  • Web 推送
  • 图片、语音、链接推送
  • 配额与统计

实现概要

  • 在 gopush 中进行实现(web 进程)
  • 用户登录后返回
    • id:作为 gopush 的 key
    • token:用于身份验证
  • 用户/应用/群/组织机构都是使用 id 作为 key
  • 用户未登录时使用默认的 key
  • 用户发送群组消息时转为对该群组内所有用户的 id 批量发送
  • 对外提供对应用数据管理的 RESTful 接口,例如用户 CRUD

数据库表

  • 用户(user、user_user)
  • 组织机构(tenant、org、org_user)
  • 应用(application)
  • 群(qun、qun_user)
  • 客户端版本(client_version)

会话

一个会话对应一个推送连接,连接断开会话终止。

可以针对会话级别进行推送控制,请参考会话推送

Name

使用 Name 作为 gopush-cluster 的 key。

  • 监听:会话 id + @后缀 (监听客户端知道自己的会话)
  • 发送:会话 id + @后缀 (推送时服务端根据参数 sessions 拼装会话 id)
  • 获取离线消息:uid + @后缀

@后缀

  • 组织机构单位:@tenant
  • 组织机构部门:@org
  • 群:@qun
  • 用户:@user
  • 应用:@app

开发中可以使用定义在 app/config.go 中的常量。

开发

  • 熟悉 gopush-cluster 的架构
  • 项目只能在 Linux 下开发(通过虚拟机方式方便一些)

web 模块

迁出项目后需要修改 web.conf,用于在当前目录下运行的默认配置文件。

  • base.app.bind:应用接口监听端口
  • zookeeper.addr:gopush-cluster 集群节点通知
  • user daniel:当前操作系统登录用户
  • 其他默认 IP 绑定

启动命令 ./web -v=3 -logtostderr=true

Postman

Postman 是一个 Chrome 扩展,用于开发时调试 HTTP 接口。

GitBook

部署

  • static、view 需要放到 bin 目录下

appmsgsrv's People

Contributors

88250 avatar sf100 avatar soa4java 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.