constructor - SockJsClient
Şöyle yaparız.
ListenableFuture<StompSession> nesnesi döner.
Şöyle yaparız.
WebSocketClient simpleWebSocketClient = new StandardWebSocketClient();
List<Transport> transports = new ArrayList<>(1);
transports.add(new WebSocketTransport(simpleWebSocketClient));
SockJsClient sockJsClient = new SockJsClient(transports);
WebSocketStompClient stompClient = new WebSocketStompClient(sockJsClient);
connect metoduListenableFuture<StompSession> nesnesi döner.
Örnek
Şöyle yaparız.
setMessageConverter metodu
Şöyle yaparız.
String url = "ws://localhost:9080/Vault713MQServer/websocket";
StompSessionHandler sessionHandler = ...;
StompSession session = stompClient.connect(url, sessionHandler).get();
Örnek
Şöyle yaparız
WebSocketClient transport = new StandardWebSocketClient();
WebSocketStompClient stompClient = new WebSocketStompClient(transport);
WebSocketHttpHeaders webSocketHttpHeaders = new WebSocketHttpHeaders();
webSocketHttpHeaders.add("Authorization","Bearer XXXXXX");
stompClient.setMessageConverter(new StringMessageConverter());
stompClient.connect("ws://localhost:8080/test", webSocketHttpHeaders,
new CustomStompSessionHandler())
Şöyle yaparız.
WebSocketClient simpleWebSocketClient = new StandardWebSocketClient();
List<Transport> transports = new ArrayList<>(1);
transports.add(new WebSocketTransport(simpleWebSocketClient));
SockJsClient sockJsClient = new SockJsClient(transports);
stompClient = new WebSocketStompClient(sockJsClient);
stompClient.setMessageConverter(new MappingJackson2MessageConverter());
Hiç yorum yok:
Yorum Gönder