Şu satırı dahil ederiz
constructorimport org.springframework.web.socket.client.WebSocketConnectionManager;import org.springframework.web.socket.client.standard.StandardWebSocketClient;import org.springframework.web.socket.handler.TextWebSocketHandler;
Şöyle yaparız
public class MyTextWebSocketHandler extends TextWebSocketHandler {...}String wsUrl = ...;//A WebSocket connection manager that is given a URI, a WebSocketClient, and a
//WebSocketHandler, connects to a WebSocket server through start() and stop() methods.//If setAutoStartup(boolean) is set to true this will be done automatically when the Spring
//ApplicationContext is refreshed.WebSocketConnectionManager connectionManager =new WebSocketConnectionManager(new StandardWebSocketClient(),new MyTextWebSocketHandler(),wsUrl);connectionManager.start();
Hiç yorum yok:
Yorum Gönder