25 lines
664 B
Kotlin
25 lines
664 B
Kotlin
package io.legato.kazusa.web
|
|
|
|
import fi.iki.elonen.NanoWSD
|
|
import io.legato.kazusa.service.WebService
|
|
import io.legato.kazusa.web.socket.*
|
|
|
|
class WebSocketServer(port: Int) : NanoWSD(port) {
|
|
|
|
override fun openWebSocket(handshake: IHTTPSession): WebSocket? {
|
|
WebService.serve()
|
|
return when (handshake.uri) {
|
|
"/bookSourceDebug" -> {
|
|
BookSourceDebugWebSocket(handshake)
|
|
}
|
|
"/rssSourceDebug" -> {
|
|
RssSourceDebugWebSocket(handshake)
|
|
}
|
|
"/searchBook" -> {
|
|
BookSearchWebSocket(handshake)
|
|
}
|
|
else -> null
|
|
}
|
|
}
|
|
}
|