appmsgsrv

module
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 30, 2014 License: GPL-3.0

README

应用消息服务 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 目录下

Directories

Path Synopsis
client
refer https://github.com/mncaudill/ketama The MIT License (MIT) Copyright (c) 2013 Nolan Caudill Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
refer https://github.com/mncaudill/ketama The MIT License (MIT) Copyright (c) 2013 Nolan Caudill Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
test

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL