Skip to content

Instantly share code, notes, and snippets.

@kylebrowning kylebrowning/push.swift Secret
Created Feb 7, 2019

Embed
What would you like to do?
router.get("push") { req -> String in
let devices = Device.query(on: req).all().map({ (devices) -> [Device] in
try devices.forEach({ (device) in
let temp = try req.make(APNS.self)
let alert = Alert(title: "Hey There", subtitle: "Subtitle", body: "Body")
let aps = Aps(alert: alert, category: nil, badge: 1)
let new = try temp.send(deviceToken: device.deviceToken, aps: aps, group: req.eventLoop)
})
return devices
})
return "Pushed to everyone!!"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.