This service allows to easily integrate Gorush into Vapor to send push notifications.
.package(url: "https://github.com/code28/vapor-gorush.git", from: "0.1.0")
// ...
.target(name: "App", dependencies: ["Vapor", "Gorush"])
services.register(Gorush.self) { container in
return Gorush(hostname: Environment.get("GORUSH_HOSTNAME"), port: Environment.get("GORUSH_PORT"))
}
Per default, HTTPS will be used. To use HTTP instead, just add httpScheme: .http
into that initialization.
import Gorush
// ...
let notification = GorushNotification(tokens: ["deviceToken"], platform: .ios, message: "Push message", title: "Push title")
let gorush = container.make(Gorush.self)
gorush.dispatch(notification, on: worker)
// ...
This vapor-gorush package is released under an MIT license. See License for more information.
- Parse Gorush response and answer with succeeded or failed future
- Write further documentation
- Complete fields for Gorush notification
- Write tests