Class ViteSessionTracker
java.lang.Object
com.vaadin.base.devserver.viteproxy.ViteSessionTracker
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceListener interface for HTTP session close events. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds a listener that will be notified when an HTTP session is closed.voidNotifies all registered listeners that the given HTTP session has closed.
-
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
Notifies all registered listeners that the given HTTP session has closed.- Parameters:
httpSessionId- the ID of the HTTP session that was closedcloseCode- the WebSocket close code to use (e.g., 1008 for VIOLATED_POLICY)closeMessage- the close message to send with the WebSocket close
-