@@ -4,15 +4,17 @@ import io.ktor.server.application.*
44import io.ktor.server.engine.*
55import io.ktor.server.http.content.*
66import io.ktor.server.netty.*
7- import io.ktor.server.plugins.callloging.*
7+ import io.ktor.server.plugins.calllogging.CallLogging
88import io.ktor.server.plugins.defaultheaders.*
99import io.ktor.server.routing.*
1010import io.ktor.server.sessions.*
1111import io.ktor.server.websocket.*
1212import io.ktor.util.*
1313import io.ktor.websocket.*
1414import kotlinx.coroutines.channels.*
15- import java.time.*
15+ import kotlinx.serialization.Serializable
16+ import kotlin.time.Duration
17+ import kotlin.time.Duration.Companion.minutes
1618
1719/* *
1820 * An entry point of the application.
@@ -61,7 +63,7 @@ class ChatApplication {
6163 // This installs the WebSockets plugin to be able to establish a bidirectional configuration
6264 // between the server and the client
6365 install(WebSockets ) {
64- pingPeriod = Duration .ofMinutes( 1 )
66+ pingPeriod = 1 .minutes
6567 }
6668 // This enables the use of sessions to keep information between requests/refreshes of the browser.
6769 install(Sessions ) {
@@ -121,19 +123,14 @@ class ChatApplication {
121123 }
122124
123125 // This defines a block of static resources for the '/' path (since no path is specified and we start at '/')
124- static {
125- // This marks index.html from the 'web' folder in resources as the default file to serve.
126- defaultResource(" index.html" , " web" )
127- // This serves files from the 'web' folder in the application resources.
128- resources(" web" )
129- }
130-
126+ staticResources(" " , " web" )
131127 }
132128 }
133129
134130 /* *
135131 * A chat session is identified by a unique nonce ID. This nonce comes from a secure random source.
136132 */
133+ @Serializable
137134 data class ChatSession (val id : String )
138135
139136 /* *
0 commit comments