Skip to content

Commit

Permalink
reconnect while close abnormally
Browse files Browse the repository at this point in the history
  • Loading branch information
MrXiaoM committed Jan 7, 2024
1 parent 3a893c5 commit 10537f2
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.sync.Mutex
import kotlinx.coroutines.sync.withLock
import org.java_websocket.client.WebSocketClient
import org.java_websocket.framing.CloseFrame
import org.java_websocket.handshake.ServerHandshake
import org.slf4j.Logger
import java.net.URI
Expand Down Expand Up @@ -98,6 +99,9 @@ class WSClient(
if (mutex.isLocked) mutex.unlock()
if (ActionSendUtils.mutex.isLocked) ActionSendUtils.mutex.unlock()
}
if (retryCount < 1 && code != CloseFrame.NORMAL) { // TODO: 测试确认异常关闭码
reconnectBlocking()
}
}

override fun onError(ex: Exception) {
Expand Down

0 comments on commit 10537f2

Please sign in to comment.