Interface ReconnectStrategy

All Known Implementing Classes:
ExponentialBackoffStrategy

public interface ReconnectStrategy
Strategy interface for WebSocket reconnection behavior.

WebSocket 重连行为的策略接口。

Since:
6.2.0
Version:
1.0.0
Author:
wisdomme
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Gets the current attempt count.
    long
    Gets the delay in milliseconds before the next reconnection attempt.
    void
    Resets the strategy state (called on successful connection).
    boolean
    Checks if reconnection should continue.
  • Method Details

    • getNextDelay

      long getNextDelay()
      Gets the delay in milliseconds before the next reconnection attempt. 获取下次重连尝试前的延迟(毫秒)。
      Returns:
      the delay in milliseconds
    • reset

      void reset()
      Resets the strategy state (called on successful connection). 重置策略状态(在连接成功时调用)。
    • getAttemptCount

      int getAttemptCount()
      Gets the current attempt count. 获取当前尝试次数。
      Returns:
      the number of attempts made
    • shouldContinue

      boolean shouldContinue()
      Checks if reconnection should continue. 检查是否应该继续重连。
      Returns:
      true if more reconnection attempts should be made