Skip to content

Instantly share code, notes, and snippets.

@capJavert
Last active March 22, 2018 00:22
Show Gist options
  • Save capJavert/57eac0570504fab35fed605bb95eecd1 to your computer and use it in GitHub Desktop.
Save capJavert/57eac0570504fab35fed605bb95eecd1 to your computer and use it in GitHub Desktop.
Push service endpoints
POST /push - subscribe user by user_id with device_token
param: device_token: String
param: user_id: Int
Authorization: token: String - user Auth token
returns:
{
...
data: {
user_id: Int,
subscription_id: Int
}
}
DELETE /push/:subscription_id - unsubscribe user by subscription_id
Authorization: token: String - user Auth token
{
...
message: String
}
db model:
PushSubscription {
subscription_id: Int (pk, autonumber)
user_id: String
deviceToken: String
}
// multiple users can have multiple devices registered
// on user logout user subscription is deleted for specific device
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment