Class ViteSessionTracker

java.lang.Object
com.vaadin.base.devserver.viteproxy.ViteSessionTracker

public class ViteSessionTracker extends Object
Tracks HTTP session closures and notifies registered listeners.

This allows WebSocket connections to be notified when their associated HTTP session is invalidated, enabling them to close the WebSocket with an appropriate close code that the client can detect.

This class is meant only for testing purposes. Do not use it in production.

For internal use only. May be renamed or removed in a future release.

  • Constructor Details

    • ViteSessionTracker

      public ViteSessionTracker()
  • Method Details

    • addListener

      Adds a listener that will be notified when an HTTP session is closed.
      Parameters:
      listener - a listener that receives the HTTP session ID, close code, and close message
      Returns:
      a registration that can be used to remove the listener
    • close

      public void close(String httpSessionId, int closeCode, String closeMessage)
      Notifies all registered listeners that the given HTTP session has closed.
      Parameters:
      httpSessionId - the ID of the HTTP session that was closed
      closeCode - the WebSocket close code to use (e.g., 1008 for VIOLATED_POLICY)
      closeMessage - the close message to send with the WebSocket close