Skip to content

Commit e4eb740

Browse files
committed
feat: update okex websocket endpoint
1 parent d41bcd1 commit e4eb740

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

reactive-crypto-okex/src/main/kotlin/com/njkim/reactivecrypto/okex/OkexWebsocketClient.kt

+4-3
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import mu.KotlinLogging
3636
import org.apache.commons.compress.compressors.deflate64.Deflate64CompressorInputStream
3737
import org.springframework.util.StreamUtils
3838
import reactor.core.publisher.Flux
39+
import reactor.kotlin.core.publisher.toFlux
3940
import reactor.netty.http.client.HttpClient
4041
import java.math.BigDecimal
4142
import java.nio.charset.Charset
@@ -44,7 +45,7 @@ import java.util.concurrent.ConcurrentHashMap
4445
import kotlin.streams.toList
4546

4647
open class OkexWebsocketClient(
47-
private val baseUri: String = "wss://real.okex.com:10442/ws/v3"
48+
private val baseUri: String = "wss://real.okex.com:8443/ws/v3"
4849
) : AbstractExchangeWebsocketClient() {
4950
private val log = KotlinLogging.logger {}
5051

@@ -148,7 +149,7 @@ open class OkexWebsocketClient(
148149
val subscribeMessages = subscribeTargets.stream()
149150
.map { "${it.baseCurrency.symbol}-${it.quoteCurrency.symbol}" }
150151
.map { "{\"op\": \"subscribe\", \"args\": [\"spot/trade:$it\"]}" }
151-
.toList()
152+
.toFlux()
152153

153154
return HttpClient.create()
154155
.wiretap(log.isDebugEnabled)
@@ -160,7 +161,7 @@ open class OkexWebsocketClient(
160161
.websocket()
161162
.uri(baseUri)
162163
.handle { inbound, outbound ->
163-
outbound.sendString(Flux.fromIterable<String>(subscribeMessages))
164+
outbound.sendString(subscribeMessages)
164165
.then()
165166
.thenMany(inbound.receive().asString())
166167
}

0 commit comments

Comments
 (0)