chibenwa commented on a change in pull request #423:
URL: https://github.com/apache/james-project/pull/423#discussion_r629327391
##########
File path:
server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/core/JmapRfc8621Configuration.scala
##########
@@ -25,28 +25,33 @@ import org.apache.commons.configuration2.Configuration
import org.apache.james.jmap.core.JmapRfc8621Configuration.UPLOAD_LIMIT_30_MB
import org.apache.james.util.Size
+import scala.concurrent.duration.Duration
+
object JmapRfc8621Configuration {
val LOCALHOST_URL_PREFIX: String = "http://localhost"
val UPLOAD_LIMIT_30_MB: MaxSizeUpload = MaxSizeUpload.of(Size.of(30L,
Size.Unit.M)).get
- val LOCALHOST_CONFIGURATION: JmapRfc8621Configuration =
JmapRfc8621Configuration(LOCALHOST_URL_PREFIX, UPLOAD_LIMIT_30_MB)
+ val LOCALHOST_CONFIGURATION: JmapRfc8621Configuration =
JmapRfc8621Configuration(LOCALHOST_URL_PREFIX, None, UPLOAD_LIMIT_30_MB)
val URL_PREFIX_PROPERTIES: String = "url.prefix"
+ val WEBSOCKET_INTERVAL_PROPERTIES: String = "websocket.ping.interval"
Review comment:
We need to document this option in
`docs/modules/servers/pages/distributed/configure/jmap.adoc` and in
`src/site/xdoc/server/config-jmap.xml`
##########
File path:
server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/core/JmapRfc8621Configuration.scala
##########
@@ -25,28 +25,33 @@ import org.apache.commons.configuration2.Configuration
import org.apache.james.jmap.core.JmapRfc8621Configuration.UPLOAD_LIMIT_30_MB
import org.apache.james.util.Size
+import scala.concurrent.duration.Duration
+
object JmapRfc8621Configuration {
val LOCALHOST_URL_PREFIX: String = "http://localhost"
val UPLOAD_LIMIT_30_MB: MaxSizeUpload = MaxSizeUpload.of(Size.of(30L,
Size.Unit.M)).get
- val LOCALHOST_CONFIGURATION: JmapRfc8621Configuration =
JmapRfc8621Configuration(LOCALHOST_URL_PREFIX, UPLOAD_LIMIT_30_MB)
+ val LOCALHOST_CONFIGURATION: JmapRfc8621Configuration =
JmapRfc8621Configuration(LOCALHOST_URL_PREFIX, None, UPLOAD_LIMIT_30_MB)
val URL_PREFIX_PROPERTIES: String = "url.prefix"
+ val WEBSOCKET_INTERVAL_PROPERTIES: String = "websocket.ping.interval"
val UPLOAD_LIMIT_PROPERTIES: String = "upload.max.size"
def from(configuration: Configuration): JmapRfc8621Configuration = {
JmapRfc8621Configuration(
urlPrefixString =
Option(configuration.getString(URL_PREFIX_PROPERTIES)).getOrElse(LOCALHOST_URL_PREFIX),
+ pingInterval =
Option(configuration.getString(WEBSOCKET_INTERVAL_PROPERTIES)).map(Duration.apply),
Review comment:
We have a `DurationParser`
##########
File path:
server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/routes/WebSocketRoutes.scala
##########
@@ -110,10 +111,17 @@ class WebSocketRoutes @Inject()
(@Named(InjectionKeys.RFC_8621) val authenticato
.flatMap(message => handleClientMessages(context)(message))
.doOnTerminate(context.clean)
- out.sendString(
+ val applicativeMessages: SFlux[OutboundMessage] =
SFlux.merge(Seq(responseFlux, sink.asFlux()))
- .map(ResponseSerializer.serialize)
- .map(Json.stringify))
+
+ val pings: SFlux[OutboundMessage] = configuration.pingInterval
+ .map(any => SFlux.interval(any)
+ .map(_ => PingMessage(???)))
Review comment:
We can use the value 'long' generated by the ping interval to generate
the ping payload
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]