Skip to content

Commit

Permalink
Remove the deprecated SpringDefaultWebSocketClient and SpringSockJSWe…
Browse files Browse the repository at this point in the history
…bSocketClient objects

Resolves:
#411
  • Loading branch information
joffrey-bion committed Feb 18, 2024
1 parent c2d93e3 commit 3b5339c
Showing 1 changed file with 6 additions and 53 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,16 @@

package org.hildan.krossbow.websocket.spring

import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.future.await
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.sync.Mutex
import kotlinx.coroutines.sync.withLock
import kotlinx.coroutines.*
import kotlinx.coroutines.flow.*
import kotlinx.coroutines.future.*
import kotlinx.coroutines.sync.*
import kotlinx.io.*
import kotlinx.io.bytestring.*
import org.hildan.krossbow.io.*
import org.hildan.krossbow.websocket.WebSocketConnectionException
import org.hildan.krossbow.websocket.WebSocketConnectionWithPingPong
import org.hildan.krossbow.websocket.WebSocketFrame
import org.hildan.krossbow.websocket.WebSocketListenerFlowAdapter
import org.hildan.krossbow.websocket.*
import org.springframework.web.socket.*
import org.springframework.web.socket.client.standard.StandardWebSocketClient
import org.springframework.web.socket.sockjs.client.RestTemplateXhrTransport
import org.springframework.web.socket.sockjs.client.SockJsClient
import org.springframework.web.socket.sockjs.client.Transport
import org.springframework.web.socket.sockjs.client.WebSocketTransport
import java.net.URI
import java.nio.ByteBuffer
import java.net.*
import org.hildan.krossbow.websocket.WebSocketClient as KrossbowWebSocketClient
import org.springframework.web.socket.WebSocketSession as SpringWebSocketSession
import org.springframework.web.socket.client.WebSocketClient as SpringWebSocketClient
Expand All @@ -34,20 +23,6 @@ import org.springframework.web.socket.client.WebSocketClient as SpringWebSocketC
@Suppress("DEPRECATION")
fun SpringWebSocketClient.asKrossbowWebSocketClient(): KrossbowWebSocketClient = SpringWebSocketClientAdapter(this)

@Deprecated(
message = "The SpringDefaultWebSocketClient object is made redundant by the public adapter extension" +
".asKrossbowWebSocketClient(), prefer using that instead.",
replaceWith = ReplaceWith(
expression = "StandardWebSocketClient().asKrossbowWebSocketClient()",
imports = [
"org.springframework.web.socket.client.standard.StandardWebSocketClient",
"org.hildan.krossbow.websocket.spring.asKrossbowWebSocketClient",
],
)
)
@Suppress("DEPRECATION")
object SpringDefaultWebSocketClient : SpringWebSocketClientAdapter(StandardWebSocketClient())

@Deprecated(
message = "The JettyWebSocketClient is deprecated for removal in Spring itself, prefer the StandardWebSocketClient.",
replaceWith = ReplaceWith(
Expand All @@ -63,28 +38,6 @@ object SpringJettyWebSocketClient : SpringWebSocketClientAdapter(
org.springframework.web.socket.client.jetty.JettyWebSocketClient().apply { start() },
)

@Deprecated(
message = "The SpringSockJSWebSocketClient object is made redundant by the public adapter extension" +
".asKrossbowWebSocketClient(), prefer using that instead.",
replaceWith = ReplaceWith(
expression = "SockJsClient(listOf(WebSocketTransport(StandardWebSocketClient()), RestTemplateXhrTransport())).asKrossbowWebSocketClient()",
imports = [
"org.springframework.web.socket.client.standard.StandardWebSocketClient",
"org.springframework.web.socket.sockjs.client.SockJsClient",
"org.springframework.web.socket.sockjs.client.RestTemplateXhrTransport",
"org.springframework.web.socket.sockjs.client.WebSocketTransport",
"org.hildan.krossbow.websocket.spring.asKrossbowWebSocketClient",
],
)
)
@Suppress("DEPRECATION")
object SpringSockJSWebSocketClient : SpringWebSocketClientAdapter(SockJsClient(defaultWsTransports()))

private fun defaultWsTransports(): List<Transport> = listOf(
WebSocketTransport(StandardWebSocketClient()),
RestTemplateXhrTransport()
)

@Deprecated(
message = "This class is internal and will become invisible in future versions, " +
"prefer the adapter extension asKrossbowWebSocketClient().",
Expand Down

0 comments on commit 3b5339c

Please sign in to comment.