obito

command module
v0.0.0-...-aea9b91 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2018 License: MIT Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

iOS推送服务

我们直连APNs. 极光送达率真是感人...

本项目使用Redis + Golang打造,API请求延迟在1ms以内。

Table of Contents

使用方法:

$ git clone https://github.com/jiajunhuang/obito
$ cd obito
$ go build
$ # 另外需要crontab配合使用,定期清除已过期的key
$ cd cron
$ go build

开发工程中感谢iOS客户端童鞋的大力支持,谢谢!

redis中的key都比较长,后续如果内存吃紧,可以考虑使用更加短的方案,但是目前来说 还在可接受范围内

使用指南

首先,需要iOS端配合做好以下工作:

  • app在首次启动之后在沙箱内生成一个 uuid 作为唯一识别码
  • 每次打开app的时候获取 device_token 并且和上一次对比,如果发生了变化,则需要 调用 /report 上报新的 device_token ,完成 UUID 和 device_token 配对的更新
  • 每次打开app需要调用 /badge/clear 接口清除服务端存储的badge数量。

API

所有操作,如果成功,则返回:

状态码为200且json为

{
    "code": 200,
    "message": "",
    "result": {}
}

如果失败,则返回:

状态码为400,500等,且json为

{
    "code": 400,
    "message": "具体错误提示",
    "result": {}
}
给设备打tag

POST /tag

带上以下JSON:

{
    "uuid": "12345678-1730-4414-9728-95616073fe82",
    "tag_list": ["tag1", "tag2"]
}
给某个设备发送推送

POST /push

带上以下JSON:

{
    "uuid": "12345678-1730-4414-9728-95616073fe82",
    "content": "Hello, this is a test with very long somewhat"
}
清除badge

DELETE /badge

带上以下JSON:

{
    "uuid": "12345678-1730-4414-9728-95616073fe82"
}
按tag推送

POST /tag/push

带上以下JSON:

{
    "tag": "tag1",
    "content": "push_by_tag"
}
上报设备信息

POST /report

带上以下JSON:

{
    "uuid": "f8206027-8752-4850-bb20-3ae0f23d082e",
    "device_token": "12345678-1730-4414-9728-95616073fe82"
}

MIT License

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

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