Commit 89ccca86 by pye52

现在初次链接状态也会发送信息到界面了

parent 5f0003b3
......@@ -77,6 +77,11 @@ public class SCWebSocketClient extends WebSocketClient {
SCTaskExecutor.getInstance().executeOnDiskIO(() -> {
try {
boolean connectResult = connectBlocking(10, TimeUnit.SECONDS);
if (connectResult) {
connectState.postValue(new ConnectState(ConnectState.CONNECTED, host.toString()));
} else {
connectState.postValue(new ConnectState(ConnectState.OFFLINE));
}
LogUtils.d(TAG, connectResult ? "成功链接服务器" : "链接服务器失败");
} catch (InterruptedException e) {
LogUtils.e(TAG, "服务器链接异常: " + e.getMessage());
......
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 sign in to comment