Skip to content
This repository has been archived by the owner on Oct 23, 2024. It is now read-only.

Spring_websocket_support_cn

maosi edited this page Aug 27, 2017 · 2 revisions

在fastjson-1.2.16版本开始,新增加spring websocket支持,支持的实现如下:

com.alibaba.fastjson.support.spring.FastjsonSockJsMessageCodec

初始支持,遇到问题请大家反馈

@Component
@EnableWebSocket
public class WebSocketConfig extends WebMvcConfigurerAdapter implements WebSocketConfigurer {

	@Resource
	WebSocketHandler handler;

	public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
		registry.addHandler(handler, "/sockjs").withSockJS().setMessageCodec(new FastjsonSockJsMessageCodec());
	}

}
Clone this wiki locally