Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #356 - expand idle timeouts #377

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 45 additions & 3 deletions api/client/src/main/java/jakarta/websocket/Session.java
Original file line number Diff line number Diff line change
Expand Up @@ -173,21 +173,63 @@ public interface Session extends Closeable {

/**
* Return the number of milliseconds before this conversation may be closed by the container if it is inactive, i.e.
* no messages are either sent or received in that time.
* no messages are either sent or received in that time. A value that is zero or negative indicates that this
* timeout will not be used. The read specific ({@link #getMaxReadIdleTimeout()} and/or write specific {@link
* #getMaxWriteIdleTimeout()} timeouts may still apply.
*
* @return the timeout in milliseconds.
*/
long getMaxIdleTimeout();

/**
* Set the non-zero number of milliseconds before this session will be closed by the container if it is inactive, ie
* no messages are either sent or received. A value that is 0 or negative indicates the session will never timeout
* due to inactivity.
* no messages are either sent or received. A value that is 0 or negative indicates that this timeout will not be
* used. The read specific ({@link #getMaxReadIdleTimeout()} and/or write specific {@link #getMaxWriteIdleTimeout()}
* timeouts may still apply.
*
* @param milliseconds the number of milliseconds.
*/
void setMaxIdleTimeout(long milliseconds);

/**
* Return the number of milliseconds before this conversation may be closed by the container if no messages are
* received in that time. A value that is zero or negative indicates that this timeout will not be used. The general
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Complete message? (all data frames?)
Partial message? (some data frames? an incomplete data frame?)
Control frame?
Reset on receive of traffic?
Or reset on delivery of data frame? or any frame? or even auto-fragmented frame?
What if the connection has higher level activity not within websocket (eg: http/2 stream specific details, or http/3 stream specific details)?

* read/write ({@link #getMaxIdleTimeout()} and/or write specific {@link #getMaxWriteIdleTimeout()} timeouts may
* still apply.
*
* @return the timeout in milliseconds.
*/
long getMaxReadIdleTimeout();

/**
* Set the non-zero number of milliseconds before this session will be closed by the container if no messages are
* received. A value that is 0 or negative indicates that this timeout will not be used. The general read/write
* ({@link #getMaxReadIdleTimeout()} and/or write specific {@link #getMaxWriteIdleTimeout()} timeouts may still
* apply.
*
* @param milliseconds the number of milliseconds.
*/
void setMaxReadIdleTimeout(long milliseconds);

/**
* Return the number of milliseconds before this conversation may be closed by the container if no messages are
* sent in that time. A value that is zero or negative indicates that this timeout will not be used. The general
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sent by what?
The application has requested a send?
The extension has enough information to send something?
The websocket connection has sent it?
The HTTP/2 stream has sent it?
The TCP connection has sent it?
The HTTP/3 stream has sent it? Do we wait for confirmation on HTTP/3 of the send?

* read/write ({@link #getMaxIdleTimeout()} and/or read specific {@link #getMaxReadIdleTimeout()} timeouts may still
* apply.
*
* @return the timeout in milliseconds.
*/
long getMaxWriteIdleTimeout();

/**
* Set the non-zero number of milliseconds before this session will be closed by the container if no messages are
* sent. A value that is 0 or negative indicates that this timeout will not be used. The general read/write
* ({@link #getMaxReadIdleTimeout()} and/or read specific {@link #getMaxReadIdleTimeout()} timeouts may still apply.
*
* @param milliseconds the number of milliseconds.
*/
void setMaxWriteIdleTimeout(long milliseconds);

/**
* Sets the maximum length of incoming binary messages that this Session can buffer.
*
Expand Down