在@ServerEndpoint类中的 @OnOpen public void onOpen(Session session)方法 中 session.setMaxIdleTimeout(3600000);