-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Replace java.time with kotlin.time in websockets configuration #4315
Conversation
* Ping interval or `null` to disable pinger. Please note that pongs will be handled despite this setting. | ||
*/ | ||
@Deprecated("Use variant with kotlin.time.Duration", level = DeprecationLevel.ERROR) | ||
public inline var DefaultWebSocketServerSession.pingInterval: Duration? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now I'm not sure that it worth to keep these extensions with deprecation as they could confuse users 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think it would be a little confusing. It would be nice to drop the JVM source path entirely for this plugin too. It's an easy migration for them anyway.
* Ping interval meaning pinger is disabled. | ||
* @see pingIntervalMillis | ||
*/ | ||
public const val PINGER_DISABLED: Long = 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be discussed: With this constant code seems a bit clearer, but I'm not sure if I chose the right place for it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it'd be best under the WebSockets
companion since that's the only type users are generally exposed to.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only thing I don't like is that it will be two constants, one for a client plugin and another for a server plugin.
I thought about making these constants pointing to the same constant in the shared module, but it will result in imports ambiguity.
public const val PINGER_DISABLED: Long = DefaultWebSocketSession.PINGER_DISABLED
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bjhham, what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I see, maybe in that case it can be a top-level declaration.
fb70368
to
f381e4f
Compare
* Ping interval or `null` to disable pinger. Please note that pongs will be handled despite this setting. | ||
*/ | ||
@Deprecated("Use variant with kotlin.time.Duration", level = DeprecationLevel.ERROR) | ||
public inline var DefaultWebSocketServerSession.pingInterval: Duration? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think it would be a little confusing. It would be nice to drop the JVM source path entirely for this plugin too. It's an easy migration for them anyway.
* Ping interval meaning pinger is disabled. | ||
* @see pingIntervalMillis | ||
*/ | ||
public const val PINGER_DISABLED: Long = 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it'd be best under the WebSockets
companion since that's the only type users are generally exposed to.
e7426af
to
7217fc8
Compare
Introduce PINGER_DISABLED constant
7217fc8
to
a7e604c
Compare
Subsystem
Client/Server,
ktor-server-websockets
,ktor-client-core
,ktor-shared:ktor-websockets
Motivation
KTOR-7446 Replace
java.time
options in Websockets pluginSolution
Replaced
java.time.Duration
withkotlin.time.Duration
. MovedDuration
extensions to the common source set. AddedDuration
support to a websocket client.