类 WebSocketStompClient

    • 方法详细资料

      • setTaskScheduler

        public void setTaskScheduler​(TaskScheduler taskScheduler)
        Configure a scheduler to use for heartbeats and for receipt tracking.

        Note: Some transports have built-in support to work with heartbeats and therefore do not require a TaskScheduler. Receipts however, if needed, do require a TaskScheduler to be configured.

        By default, this is not set.

        Also automatically sets the defaultHeartbeat property to "10000,10000" if it is currently set to "0,0".

        覆盖:
        setTaskScheduler 在类中 StompClientSupport
      • setInboundMessageSizeLimit

        public void setInboundMessageSizeLimit​(int inboundMessageSizeLimit)
        Configure the maximum size allowed for inbound STOMP message. Since a STOMP message can be received in multiple WebSocket messages, buffering may be required and this property determines the maximum buffer size per message.

        By default this is set to 64 * 1024 (64K).

      • setAutoStartup

        public void setAutoStartup​(boolean autoStartup)
        Set whether to auto-start the contained WebSocketClient when the Spring context has been refreshed.

        Default is "true".

      • setPhase

        public void setPhase​(int phase)
        Specify the phase in which the WebSocket client should be started and subsequently closed. The startup order proceeds from lowest to highest, and the shutdown order is the reverse of that.

        By default this is Integer.MAX_VALUE meaning that the WebSocket client is started as late as possible and stopped as soon as possible.

      • start

        public void start()
        从接口复制的说明: Lifecycle
        Start this component.

        Should not throw an exception if the component is already running.

        In the case of a container, this will propagate the start signal to all components that apply.

        指定者:
        start 在接口中 Lifecycle
        另请参阅:
        SmartLifecycle.isAutoStartup()
      • stop

        public void stop()
        从接口复制的说明: Lifecycle
        Stop this component, typically in a synchronous fashion, such that the component is fully stopped upon return of this method. Consider implementing SmartLifecycle and its stop(Runnable) variant when asynchronous stop behavior is necessary.

        Note that this stop notification is not guaranteed to come before destruction: On regular shutdown, Lifecycle beans will first receive a stop notification before the general destruction callbacks are being propagated; however, on hot refresh during a context's lifetime or on aborted refresh attempts, a given bean's destroy method will be called without any consideration of stop signals upfront.

        Should not throw an exception if the component is not running (not started yet).

        In the case of a container, this will propagate the stop signal to all components that apply.

        指定者:
        stop 在接口中 Lifecycle
        另请参阅:
        SmartLifecycle.stop(Runnable), DisposableBean.destroy()
      • stop

        public void stop​(Runnable callback)
        从接口复制的说明: SmartLifecycle
        Indicates that a Lifecycle component must stop if it is currently running.

        The provided callback is used by the LifecycleProcessor to support an ordered, and potentially concurrent, shutdown of all components having a common shutdown order value. The callback must be executed after the SmartLifecycle component does indeed stop.

        The LifecycleProcessor will call only this variant of the stop method; i.e. Lifecycle.stop() will not be called for SmartLifecycle implementations unless explicitly delegated to within the implementation of this method.

        指定者:
        stop 在接口中 SmartLifecycle
        另请参阅:
        Lifecycle.stop(), Phased.getPhase()
      • isRunning

        public boolean isRunning()
        从接口复制的说明: Lifecycle
        Check whether this component is currently running.

        In the case of a container, this will return true only if all components that apply are currently running.

        指定者:
        isRunning 在接口中 Lifecycle
        返回:
        whether the component is currently running
      • connect

        public ListenableFuture<StompSessionconnect​(String url,
                                                      StompSessionHandler handler,
                                                      Object... uriVars)
        Connect to the given WebSocket URL and notify the given StompSessionHandler when connected on the STOMP level after the CONNECTED frame is received.
        参数:
        url - the url to connect to
        handler - the session handler
        uriVars - the URI variables to expand into the URL
        返回:
        a ListenableFuture for access to the session when ready for use