package cn.sikey.websocket.config;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.convert.DurationUnit;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.context.annotation.Configuration;

import java.time.Duration;
import java.time.temporal.ChronoUnit;

@Data
@Configuration
@RefreshScope
@ConfigurationProperties("websocket")
public class WebSocketConfig {
    /**
     * 心跳间隔时长, 单位秒
     */
    @DurationUnit(ChronoUnit.SECONDS)
    private Duration heartbeatTimeout;

    /**
     * 检查超时
     * <br/>
     * 检测连接是否活跃的定时器会在10s执行一次，这里建议也设置10s
     */
    @DurationUnit(ChronoUnit.SECONDS)
    private Duration checkTimeout;

}
