Skip to content

Commit f6f6c12

Browse files
authored
Make WS plugin installation for Ktor server more flexible (#398)
1 parent 755a290 commit f6f6c12

File tree

1 file changed

+4
-1
lines changed
  • krpc/krpc-ktor/krpc-ktor-server/src/commonMain/kotlin/kotlinx/rpc/krpc/ktor/server

1 file changed

+4
-1
lines changed

krpc/krpc-ktor/krpc-ktor-server/src/commonMain/kotlin/kotlinx/rpc/krpc/ktor/server/Krpc.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ public val Krpc: ApplicationPlugin<KrpcConfigBuilder.Server> = createApplication
1818
name = "Krpc",
1919
createConfiguration = { KrpcConfigBuilder.Server() },
2020
) {
21-
application.install(WebSockets)
21+
application.pluginOrNull(WebSockets) ?: run {
22+
application.install(WebSockets)
23+
}
24+
2225
application.attributes.put(KrpcServerPluginAttributesKey, pluginConfig)
2326
}

0 commit comments

Comments
 (0)