add websockets work
This commit is contained in:
@@ -39,6 +39,8 @@ kotlin {
|
||||
implementation kotlin('stdlib')
|
||||
api "org.jetbrains.kotlinx:kotlinx-serialization-runtime-common:$kotlin_serialisation_runtime_version"
|
||||
api "org.jetbrains.kotlinx:kotlinx-serialization-cbor-common:$kotlin_serialisation_runtime_version"
|
||||
|
||||
api projectByName("postssystem.utils.common")
|
||||
}
|
||||
}
|
||||
commonTest {
|
||||
|
@@ -0,0 +1,3 @@
|
||||
package com.insanusmokrassar.postssystem.ktor
|
||||
|
||||
object CorrectCloseException : Exception()
|
@@ -0,0 +1,14 @@
|
||||
package com.insanusmokrassar.postssystem.ktor
|
||||
|
||||
private val schemaRegex = Regex("[^:]*//")
|
||||
|
||||
val String.asCorrectWebSocketUrl: String
|
||||
get() = if (startsWith("ws")) {
|
||||
this
|
||||
} else {
|
||||
if (contains("://")) {
|
||||
replace(schemaRegex, "ws://")
|
||||
} else {
|
||||
"ws://$this"
|
||||
}
|
||||
}
|
@@ -0,0 +1,7 @@
|
||||
package com.insanusmokrassar.postssystem.ktor
|
||||
|
||||
const val clientWebsocketHelloMessage = "Start getting of updates"
|
||||
const val serverWebsocketHelloMessage = "Accepted"
|
||||
|
||||
const val serverWebsocketNewMessageMessage = "NewMessage"
|
||||
const val websocketFinalizationMessage = "Final"
|
Reference in New Issue
Block a user