org.springframework.web.socket.messaging.WebSocketStompClient.getWebSocketClient()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(4.5k)|赞(0)|评价(0)|浏览(98)

本文整理了Java中org.springframework.web.socket.messaging.WebSocketStompClient.getWebSocketClient()方法的一些代码示例,展示了WebSocketStompClient.getWebSocketClient()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebSocketStompClient.getWebSocketClient()方法的具体详情如下:
包路径:org.springframework.web.socket.messaging.WebSocketStompClient
类名称:WebSocketStompClient
方法名:getWebSocketClient

WebSocketStompClient.getWebSocketClient介绍

[英]Return the configured WebSocketClient.
[中]返回已配置的WebSocketClient。

代码示例

代码示例来源:origin: spring-projects/spring-framework

  1. @Override
  2. public void start() {
  3. if (!isRunning()) {
  4. this.running = true;
  5. if (getWebSocketClient() instanceof Lifecycle) {
  6. ((Lifecycle) getWebSocketClient()).start();
  7. }
  8. }
  9. }

代码示例来源:origin: spring-projects/spring-framework

  1. @Override
  2. public void stop() {
  3. if (isRunning()) {
  4. this.running = false;
  5. if (getWebSocketClient() instanceof Lifecycle) {
  6. ((Lifecycle) getWebSocketClient()).stop();
  7. }
  8. }
  9. }

代码示例来源:origin: spring-projects/spring-framework

  1. /**
  2. * An overloaded version of
  3. * {@link #connect(String, WebSocketHttpHeaders, StompSessionHandler, Object...)}
  4. * that accepts a fully prepared {@link java.net.URI}.
  5. * @param url the url to connect to
  6. * @param handshakeHeaders the headers for the WebSocket handshake
  7. * @param connectHeaders headers for the STOMP CONNECT frame
  8. * @param sessionHandler the STOMP session handler
  9. * @return a ListenableFuture for access to the session when ready for use
  10. */
  11. public ListenableFuture<StompSession> connect(URI url, @Nullable WebSocketHttpHeaders handshakeHeaders,
  12. @Nullable StompHeaders connectHeaders, StompSessionHandler sessionHandler) {
  13. Assert.notNull(url, "'url' must not be null");
  14. ConnectionHandlingStompSession session = createSession(connectHeaders, sessionHandler);
  15. WebSocketTcpConnectionHandlerAdapter adapter = new WebSocketTcpConnectionHandlerAdapter(session);
  16. getWebSocketClient().doHandshake(adapter, handshakeHeaders, url).addCallback(adapter);
  17. return session.getSessionFuture();
  18. }

代码示例来源:origin: org.springframework/spring-websocket

  1. @Override
  2. public void stop() {
  3. if (isRunning()) {
  4. this.running = false;
  5. if (getWebSocketClient() instanceof Lifecycle) {
  6. ((Lifecycle) getWebSocketClient()).stop();
  7. }
  8. }
  9. }

代码示例来源:origin: org.springframework/spring-websocket

  1. @Override
  2. public void start() {
  3. if (!isRunning()) {
  4. this.running = true;
  5. if (getWebSocketClient() instanceof Lifecycle) {
  6. ((Lifecycle) getWebSocketClient()).start();
  7. }
  8. }
  9. }

代码示例来源:origin: apache/servicemix-bundles

  1. @Override
  2. public void stop() {
  3. if (isRunning()) {
  4. this.running = false;
  5. if (getWebSocketClient() instanceof Lifecycle) {
  6. ((Lifecycle) getWebSocketClient()).stop();
  7. }
  8. }
  9. }

代码示例来源:origin: apache/servicemix-bundles

  1. @Override
  2. public void start() {
  3. if (!isRunning()) {
  4. this.running = true;
  5. if (getWebSocketClient() instanceof Lifecycle) {
  6. ((Lifecycle) getWebSocketClient()).start();
  7. }
  8. }
  9. }

代码示例来源:origin: apache/servicemix-bundles

  1. /**
  2. * An overloaded version of
  3. * {@link #connect(String, WebSocketHttpHeaders, StompSessionHandler, Object...)}
  4. * that accepts a fully prepared {@link java.net.URI}.
  5. * @param url the url to connect to
  6. * @param handshakeHeaders the headers for the WebSocket handshake
  7. * @param connectHeaders headers for the STOMP CONNECT frame
  8. * @param sessionHandler the STOMP session handler
  9. * @return a ListenableFuture for access to the session when ready for use
  10. */
  11. public ListenableFuture<StompSession> connect(URI url, @Nullable WebSocketHttpHeaders handshakeHeaders,
  12. @Nullable StompHeaders connectHeaders, StompSessionHandler sessionHandler) {
  13. Assert.notNull(url, "'url' must not be null");
  14. ConnectionHandlingStompSession session = createSession(connectHeaders, sessionHandler);
  15. WebSocketTcpConnectionHandlerAdapter adapter = new WebSocketTcpConnectionHandlerAdapter(session);
  16. getWebSocketClient().doHandshake(adapter, handshakeHeaders, url).addCallback(adapter);
  17. return session.getSessionFuture();
  18. }

代码示例来源:origin: org.springframework/spring-websocket

  1. /**
  2. * An overloaded version of
  3. * {@link #connect(String, WebSocketHttpHeaders, StompSessionHandler, Object...)}
  4. * that accepts a fully prepared {@link java.net.URI}.
  5. * @param url the url to connect to
  6. * @param handshakeHeaders the headers for the WebSocket handshake
  7. * @param connectHeaders headers for the STOMP CONNECT frame
  8. * @param sessionHandler the STOMP session handler
  9. * @return a ListenableFuture for access to the session when ready for use
  10. */
  11. public ListenableFuture<StompSession> connect(URI url, @Nullable WebSocketHttpHeaders handshakeHeaders,
  12. @Nullable StompHeaders connectHeaders, StompSessionHandler sessionHandler) {
  13. Assert.notNull(url, "'url' must not be null");
  14. ConnectionHandlingStompSession session = createSession(connectHeaders, sessionHandler);
  15. WebSocketTcpConnectionHandlerAdapter adapter = new WebSocketTcpConnectionHandlerAdapter(session);
  16. getWebSocketClient().doHandshake(adapter, handshakeHeaders, url).addCallback(adapter);
  17. return session.getSessionFuture();
  18. }

相关文章