Skip to content
This repository has been archived by the owner on Mar 26, 2024. It is now read-only.

Commit

Permalink
Change ENABLE_WS_TRANSPORT to ENABLE_WS_SERVER
Browse files Browse the repository at this point in the history
  • Loading branch information
SerVB committed Sep 29, 2021
1 parent 7b9a127 commit 75448f0
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ intellijPluginVersion=1.1.2
javassistVersion=3.27.0-GA
kotlinVersion=1.5.20
mockitoKotlinVersion=3.2.0
projectorClientVersion=6109cc6c
projectorClientVersion=4892def9
projectorClientGroup=com.github.JetBrains.projector-client
targetJvm=11
# Give JitPack some time to build projector-client:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -668,10 +668,8 @@ class ProjectorServer private constructor(
updateThread = createUpdateThread()
caretInfoUpdater.start()

if (getOption(ENABLE_WS_TRANSPORT_PROPERTY)?.toBoolean() != false) {
WebsocketServer.createTransportBuilders().forEach {
addTransport(it.attachDefaultServerEventHandlers(clientEventHandler).build())
}
WebsocketServer.createTransportBuilders().forEach {
addTransport(it.attachDefaultServerEventHandlers(clientEventHandler).build())
}
}

Expand Down Expand Up @@ -878,7 +876,6 @@ class ProjectorServer private constructor(
private const val DEFAULT_PORT = "8887"
const val TOKEN_ENV_NAME = "ORG_JETBRAINS_PROJECTOR_SERVER_HANDSHAKE_TOKEN"
const val RO_TOKEN_ENV_NAME = "ORG_JETBRAINS_PROJECTOR_SERVER_RO_HANDSHAKE_TOKEN"
const val ENABLE_WS_TRANSPORT_PROPERTY = "ORG_JETBRAINS_PROJECTOR_SERVER_ENABLE_WS_TRANSPORT"

var ENABLE_BIG_COLLECTIONS_CHECKS = System.getProperty("org.jetbrains.projector.server.debug.collections.checks") == "true"
private const val DEFAULT_BIG_COLLECTIONS_CHECKS_SIZE = 10_000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,24 +51,26 @@ object WebsocketServer {
builders.add(HttpWsClientBuilder("$scheme://$relayUrl", serverId))
}

val host = ProjectorServer.getEnvHost()
val port = ProjectorServer.getEnvPort()
logger.info { "${ProjectorServer::class.simpleName} is starting on host $host and port $port" }
if (getOption(ENABLE_WS_SERVER_PROPERTY, "true").toBoolean()) {
val host = ProjectorServer.getEnvHost()
val port = ProjectorServer.getEnvPort()
logger.info { "${ProjectorServer::class.simpleName} is starting on host $host and port $port" }

val serverBuilder = HttpWsServerBuilder(host, port)
serverBuilder.getMainWindows = {
ProjectorServer.getMainWindows().map {
MainWindow(
title = it.title,
pngBase64Icon = it.icons
?.firstOrNull()
?.let { imageId -> ProjectorImageCacher.getImage(imageId as ImageId) as? ImageData.PngBase64 }
?.pngBase64,
)
val serverBuilder = HttpWsServerBuilder(host, port)
serverBuilder.getMainWindows = {
ProjectorServer.getMainWindows().map {
MainWindow(
title = it.title,
pngBase64Icon = it.icons
?.firstOrNull()
?.let { imageId -> ProjectorImageCacher.getImage(imageId as ImageId) as? ImageData.PngBase64 }
?.pngBase64,
)
}
}
}

builders.add(serverBuilder)
builders.add(serverBuilder)
}
return builders
}

Expand All @@ -77,4 +79,5 @@ object WebsocketServer {
private const val RELAY_PROPERTY_NAME = "ORG_JETBRAINS_PROJECTOR_SERVER_RELAY_URL"
private const val SERVER_ID_PROPERTY_NAME = "ORG_JETBRAINS_PROJECTOR_SERVER_RELAY_SERVER_ID"
private const val RELAY_USE_WSS = "ORG_JETBRAINS_PROJECTOR_SERVER_RELAY_USE_WSS"
const val ENABLE_WS_SERVER_PROPERTY = "ORG_JETBRAINS_PROJECTOR_SERVER_ENABLE_WS_SERVER"
}

0 comments on commit 75448f0

Please sign in to comment.