| | |
| | | heartbeatTimer.schedule(new TimerTask() { |
| | | @Override |
| | | public void run() { |
| | | send(("key:"+ eStockType.getStockKey()+":"+eStockType.getContryId()).getBytes()); |
| | | if (isOpen()) { |
| | | send(("key:"+ eStockType.getStockKey()+":"+eStockType.getContryId()).getBytes()); |
| | | } |
| | | |
| | | } |
| | | }, 0, 3000); // 每3秒发送一次心跳消息 |
| | | } |
| | |
| | | |
| | | @Override |
| | | public void onClose(int i, String s, boolean b) { |
| | | log.info("websocket 美国股票 关闭"+1); |
| | | log.info("websocket 美国股票 关闭 {} ", i); |
| | | } |
| | | |
| | | @Override |
| | | public void onError(Exception e) { |
| | | log.info("websocket 美国股票 错误" + e.getMessage()); |
| | | log.info("websocket 美国股票 错误{}", e.getMessage()); |
| | | } |
| | | |
| | | public void sendLoca(String message) { |