| | |
| | | isConnecting.set(false); |
| | | if (sharedExecutor != null && !sharedExecutor.isShutdown()) { |
| | | resetHeartbeatTimer(); |
| | | wsLogin(); |
| | | if (isPublic) { |
| | | subscribeAllHandlers(); |
| | | } else { |
| | | wsLogin(); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | if ("subscribe".equals(event) || "unsubscribe".equals(event)) { |
| | | log.info("[{}] {}事件: {}", logPrefix, event, response.getString("arg")); |
| | | // 订阅成功确认:解析频道名并通知对应 handler |
| | | if ("subscribe".equals(event)) { |
| | | JSONObject argObj = response.getJSONObject("arg"); |
| | | if (argObj != null) { |
| | | String channel = argObj.getString("channel"); |
| | | if (channel != null) { |
| | | for (OkxGridChannelHandler handler : channelHandlers) { |
| | | if (channel.equals(handler.getChannelName())) { |
| | | handler.onSubscribed(); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return; |
| | | } |
| | | |