| | |
| | | } |
| | | if ("subscribe".equals(event)) { |
| | | log.info("[WS] {} 订阅成功: {}", channel, response.getJSONObject("result")); |
| | | for (GateChannelHandler handler : channelHandlers) { |
| | | if (channel.equals(handler.getChannelName())) { |
| | | handler.setSubscribed(true); |
| | | break; |
| | | } |
| | | } |
| | | return; |
| | | } |
| | | if ("unsubscribe".equals(event)) { |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 检查所有已注册的频道是否都已收到订阅成功确认。 |
| | | */ |
| | | public boolean areAllSubscribed() { |
| | | if (channelHandlers.isEmpty()) return false; |
| | | for (GateChannelHandler h : channelHandlers) { |
| | | if (!h.isSubscribed()) return false; |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | // ---- heartbeat ---- |
| | | |
| | | /** |