package com.njzscloud.common.mvc.ws.config;

import lombok.Getter;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;

/**
 * Websocket 配置项
 */
@Getter
@Setter
@ConfigurationProperties("websocket")
public class WebsocketProperties {
    /**
     * 是否启用 Websocket
     */
    private boolean enable;

    /**
     * Websocket 连接地址，默认：/ws
     */
    private String endpoint = "/ws";

    /**
     * STOMP 协议配置
     */
    private StompProperties stomp = new StompProperties();

    @Getter
    @Setter
    public static class StompProperties {
        /**
         * 客户端发送消息的地址前缀
         */
        private String[] applicationPrefixes = new String[]{"/app"};

        /**
         * 广播地址前缀
         */
        private String[] broadcastPrefixes = new String[]{"/topic"};
    }

}
