Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

880
Visualizações
okhttp3: websocket - java.io.EOFException: nulo - okio.RealBufferedSource.require(RealBufferedSource.java:61)

En mi build.gradle :

 "com.squareup.okhttp3:okhttp:3.13.1", 'com.squareup.okhttp3:logging-interceptor:3.13.1',

Proyecto Kotlin abierto conectar a websocket:

 const val WEB_SOCKET_URL = "wss://api.lbkex.com/ws/V2/"; fun main(args: Array<String>) { val оkHttpClient = OkHttpClient() val wsListener = object : WebSocketListener() { override fun onOpen(ws: WebSocket, response: Response) { super.onOpen(ws, response) val requestJson = """{"action": "subscribe", "subscribe": "tick", "pair": "vtho_eth"}""" ws.send(requestJson) } override fun onClosing(webSocket: WebSocket, code: Int, reason: String) { super.onClosing(webSocket, code, reason) logger.info("ws Closing, reason = " + reason) } override fun onClosed(webSocket: WebSocket, code: Int, reason: String) { super.onClosed(webSocket, code, reason) logger.info("ws Closed") } override fun onFailure(webSocket: WebSocket, t: Throwable, response: Response?) { super.onFailure(webSocket, t, response) logger.error("ws Failure ", t) } override fun onMessage(webSocket: WebSocket, text: String) { super.onMessage(webSocket, text) logger.info("ws Text message: $text") } override fun onMessage(webSocket: WebSocket, bytes: ByteString) { super.onMessage(webSocket, bytes) } } logger.info("Started") val wsRequest = Request.Builder() .url(WEB_SOCKET_URL) .build() val ws = оkHttpClient.newWebSocket(wsRequest, wsListener) }

Como resultado, abrí con éxito webscocket en wss://api.lbkex.com/ws/V2/ .

Como resultado, el método onMessage se llama muchas veces. Lindo.

Pero después de 15 minutos, llame al método onFailure con error:

 13:40:16.687 [OkHttp https://api.lbkex.com/...] ERROR MAIN_LOGGER - ws Failure java.io.EOFException: null at okio.RealBufferedSource.require(RealBufferedSource.java:61) at okio.RealBufferedSource.readByte(RealBufferedSource.java:74) at okhttp3.internal.ws.WebSocketReader.readHeader(WebSocketReader.java:117) at okhttp3.internal.ws.WebSocketReader.processNextFrame(WebSocketReader.java:101) at okhttp3.internal.ws.RealWebSocket.loopReader(RealWebSocket.java:274) at okhttp3.internal.ws.RealWebSocket$2.onResponse(RealWebSocket.java:214) at okhttp3.RealCall$AsyncCall.execute(RealCall.java:206) at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source)
over 4 years ago · Santiago Trujillo
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda