WebSocketConfig.java 1.59 KB
Newer Older
liqin's avatar
liqin committed
1
package cn.chnmuseum.party.conf;//package com.cmbchina.business.hall.conf;
liqin's avatar
liqin committed
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
//
//import org.springframework.context.annotation.Bean;
//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;
//import org.springframework.web.socket.server.standard.ServerEndpointExporter;
//import org.springframework.web.socket.server.support.OriginHandshakeInterceptor;
//
//@Configuration
//@EnableWebSocketMessageBroker
//public class WebSocketConfig implements WebSocketMessageBrokerConfigurer {
//
//	@Override
//	public void registerStompEndpoints(
//			StompEndpointRegistry stompEndpointRegistry) {
//		// 注册STOMP 协议的节点(endpoint) 并映射到指定的URL
//		// 注册一个 STOMP 的 endpoint ,并指定使用 SockJS协议
//		stompEndpointRegistry.addEndpoint("/endpointMs")
//				.addInterceptors(new OriginHandshakeInterceptor())
//				.setAllowedOrigins("http://localhost").withSockJS();
//	}
//
//	/**
//	 * 配置消息代理
//	 *
//	 * @param registry
//	 */
//	@Override
//	public void configureMessageBroker(MessageBrokerRegistry registry) {
//		// 广播式应配置一个 /topic 的消息代理
//		registry.enableSimpleBroker("/topic");
//	}
//
//	@Bean
//	public ServerEndpointExporter serverEndpointExporter() {
//		return new ServerEndpointExporter();
//	}
//
//}