Skip to content

Repository files navigation

OfflinePush

中文

OfflinePush is a gRPC service suite for GeTui REST API v2 and APNs token-based delivery. It includes authentication, push, device and tag management, statistics, and an application-facing proxy package.

Requirements

  • Go 1.16 or later
  • GeTui REST API v2 credentials
  • MongoDB for the statistics service
  • An APNs token-authentication key only for APNs delivery
  • protoc, protoc-gen-go, protoc-gen-go-grpc, and protoc-go-inject-tag only when changing the protocol

Configuration

Create conf.json in the repository root. It is intentionally ignored by Git and must contain MongoDB and GeTui credentials. APNs configuration is optional: omit the whole apns section when APNs delivery is not needed. When present, agent_id, bundle_id, key, key_id, and team_id are required. All services read this file from their current working directory.

The default local gRPC addresses are localhost:8080 (Auth), :8082 (Push), :8084 (User), and :8086 (Stats). Services use insecure gRPC and should remain on a private network.

Run

Start Auth first, then start the remaining services in separate terminals:

go run ./server/auth
go run ./server/push
go run ./server/user
go run ./server/stats

The service contracts are in proto. APNs currently supports single-device push only; a background APNs push requires ios.aps.content_available to be 1. The remaining APIs use GeTui.

Test

go vet ./...
go test ./...

Tests can call dependent services and providers. Use non-production credentials and ensure their dependencies are available.

Generate Protocol Code

Install protoc-go-inject-tag before generating protocol code:

go install github.com/favadi/protoc-go-inject-tag@latest
./genPb.sh

License

MIT

About

Offline Push Using GeTui Rest API v2

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Used by

Contributors

Languages