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

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

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

WebSocketStompClient.setDefaultHeartbeat介绍

暂无

代码示例

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

/**
 * Class constructor. Sets {@link #setDefaultHeartbeat} to "0,0" but will
 * reset it back to the preferred "10000,10000" when a
 * {@link #setTaskScheduler} is configured.
 * @param webSocketClient the WebSocket client to connect with
 */
public WebSocketStompClient(WebSocketClient webSocketClient) {
  Assert.notNull(webSocketClient, "WebSocketClient is required");
  this.webSocketClient = webSocketClient;
  setDefaultHeartbeat(new long[] {0, 0});
}

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

/**
 * {@inheritDoc}
 * <p>Also automatically sets the {@link #setDefaultHeartbeat defaultHeartbeat}
 * property to "10000,10000" if it is currently set to "0,0".
 */
@Override
public void setTaskScheduler(@Nullable TaskScheduler taskScheduler) {
  if (!isDefaultHeartbeatEnabled()) {
    setDefaultHeartbeat(new long[] {10000, 10000});
  }
  super.setTaskScheduler(taskScheduler);
}

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

@Test
public void heartbeatDefaultValueSetWithoutScheduler() throws Exception {
  WebSocketStompClient stompClient = new WebSocketStompClient(mock(WebSocketClient.class));
  stompClient.setDefaultHeartbeat(new long[] {5, 5});
  try {
    stompClient.processConnectHeaders(null);
    fail("Expected IllegalStateException");
  }
  catch (IllegalStateException ex) {
    // ignore
  }
}

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

/**
 * Class constructor. Sets {@link #setDefaultHeartbeat} to "0,0" but will
 * reset it back to the preferred "10000,10000" when a
 * {@link #setTaskScheduler} is configured.
 * @param webSocketClient the WebSocket client to connect with
 */
public WebSocketStompClient(WebSocketClient webSocketClient) {
  Assert.notNull(webSocketClient, "WebSocketClient is required");
  this.webSocketClient = webSocketClient;
  setDefaultHeartbeat(new long[] {0, 0});
}

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

/**
 * Class constructor. Sets {@link #setDefaultHeartbeat} to "0,0" but will
 * reset it back to the preferred "10000,10000" when a
 * {@link #setTaskScheduler} is configured.
 * @param webSocketClient the WebSocket client to connect with
 */
public WebSocketStompClient(WebSocketClient webSocketClient) {
  Assert.notNull(webSocketClient, "WebSocketClient is required");
  this.webSocketClient = webSocketClient;
  setDefaultHeartbeat(new long[] {0, 0});
}

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

/**
 * {@inheritDoc}
 * <p>Also automatically sets the {@link #setDefaultHeartbeat defaultHeartbeat}
 * property to "10000,10000" if it is currently set to "0,0".
 */
@Override
public void setTaskScheduler(@Nullable TaskScheduler taskScheduler) {
  if (!isDefaultHeartbeatEnabled()) {
    setDefaultHeartbeat(new long[] {10000, 10000});
  }
  super.setTaskScheduler(taskScheduler);
}

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

/**
 * {@inheritDoc}
 * <p>Also automatically sets the {@link #setDefaultHeartbeat defaultHeartbeat}
 * property to "10000,10000" if it is currently set to "0,0".
 */
@Override
public void setTaskScheduler(@Nullable TaskScheduler taskScheduler) {
  if (!isDefaultHeartbeatEnabled()) {
    setDefaultHeartbeat(new long[] {10000, 10000});
  }
  super.setTaskScheduler(taskScheduler);
}

代码示例来源:origin: mthizo247/spring-cloud-netflix-zuul-websocket

@Bean
@ConditionalOnMissingBean(WebSocketStompClient.class)
public WebSocketStompClient stompClient(WebSocketClient webSocketClient, MessageConverter messageConverter,
                    @Qualifier("proxyStompClientTaskScheduler") TaskScheduler taskScheduler) {
  int bufferSizeLimit = 1024 * 1024 * 8;
  WebSocketStompClient client = new WebSocketStompClient(webSocketClient);
  client.setInboundMessageSizeLimit(bufferSizeLimit);
  client.setMessageConverter(messageConverter);
  client.setTaskScheduler(taskScheduler);
  client.setDefaultHeartbeat(new long[]{0, 0});
  return client;
}

相关文章