package com.jiayue.ipfcst.dataexchange.websocket;

import org.springframework.context.annotation.Configuration;
import org.springframework.messaging.simp.config.MessageBrokerRegistry;
import org.springframework.web.socket.config.annotation.EnableWebSocketMessageBroker;
import org.springframework.web.socket.config.annotation.StompEndpointRegistry;
import org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer;

/**
 * 数据交互模块的websocket 通道配置
 *
 * @author: xiuwei
 * @version:
 */
@Configuration
@EnableWebSocketMessageBroker
public class DataExchangeWebSocketConfig implements WebSocketMessageBrokerConfigurer {


  @Override
  public void configureMessageBroker(MessageBrokerRegistry config) {
    config.enableSimpleBroker("/tunnel", "/data");

  }


  @Override
  public void registerStompEndpoints(StompEndpointRegistry registry) {
    registry.addEndpoint("/pushSocket").setAllowedOrigins("*").withSockJS();
  }

}
