Move all file in fr.dcproject.
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
package fr.dcproject.component.notification.routes
|
||||
|
||||
import fr.dcproject.component.notification.NotificationsPush
|
||||
import io.ktor.locations.KtorExperimentalLocationsAPI
|
||||
import io.ktor.routing.Route
|
||||
import io.ktor.websocket.webSocket
|
||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||
|
||||
/**
|
||||
* Consume Websocket, then remove notification in redis.
|
||||
*
|
||||
* Sent all notification to websocket.
|
||||
*/
|
||||
@ExperimentalCoroutinesApi
|
||||
@KtorExperimentalLocationsAPI
|
||||
fun Route.notificationArticle(pushBuilder: NotificationsPush.Builder) {
|
||||
webSocket("/notifications") {
|
||||
pushBuilder.build(this)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package fr.dcproject.component.notification.routes
|
||||
|
||||
import io.ktor.auth.authenticate
|
||||
import io.ktor.locations.KtorExperimentalLocationsAPI
|
||||
import io.ktor.routing.Routing
|
||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||
import org.koin.ktor.ext.get
|
||||
|
||||
@ExperimentalCoroutinesApi
|
||||
@KtorExperimentalLocationsAPI
|
||||
fun Routing.installNotificationsRoutes() {
|
||||
authenticate("url") {
|
||||
notificationArticle(get())
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user