Commit 1f552daa by 王宇航

1.5.5

1.連接超時時間默認10秒
2.onClose方法錯誤內容為連接失敗時,不觸發onError方法
parent 02d2c28f
......@@ -55,7 +55,7 @@ afterEvaluate {
groupId = "com.gingersoft.connect"
artifactId = "Connect"
version = "1.5.4"
version = "1.5.5"
// 添加 POM 配置
// pom {
// name.set("GingerSoftConnect")
......
......@@ -10,7 +10,7 @@ class GingerSoftConnect {
fun connect(
ip: String,
port: Int,
connectOutTime: Int = 10,
connectOutTime: Int = 10000,
listener: SocketStateListener?
): MessageBuilder {
val uri = URI("ws://$ip:$port")
......
......@@ -41,13 +41,14 @@ class MyWebSocketClient(
}
override fun onClose(code: Int, reason: String?, remote: Boolean) {
status = if(reason!=null && reason.contains("failed to connect")){
onError(ConnectException(reason))
3
} else {
// = if(reason!=null && reason.contains("failed to connect")){
// onError(ConnectException(reason))
// 3
// } else {
listener?.onClose(code, reason, remote)
2
}
status = 2
// 2
// }
}
override fun onError(ex: Exception?) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment