|
没太明白,能用代码体现下吗
- public void afterConnectionEstablished(WebSocketSession session) throws Exception {
- session.sendMessage(new TextMessage("{\"badd\":true,\"puid\":[\"PU_264F708E\"]}"));
- System.out.println("####发送订阅参数");
- scheduledFuture = scheduledExecutor.scheduleWithFixedDelay(() -> {
- try {
- System.out.println(Thread.currentThread().getName() + "###发送心跳包");
- session.sendMessage(new TextMessage(""));
- } catch (Exception e) {
- e.printStackTrace();
- }
- }, 20000, 20000, TimeUnit.MILLISECONDS);
- System.out.println("### connect ok");
- }
copycode
|
|