[
https://issues.apache.org/jira/browse/WICKET-6969?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17520920#comment-17520920
]
ASF GitHub Bot commented on WICKET-6969:
----------------------------------------
martin-g commented on code in PR #509:
URL: https://github.com/apache/wicket/pull/509#discussion_r847987046
##########
wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/WebSocketResponse.java:
##########
@@ -87,13 +98,27 @@ public void close()
{
if (text != null)
{
- connection.sendMessage(text.toString());
+ if (asynchronous)
+ {
+
connection.sendMessageAsync(text.toString(), timeout);
+ }
+ else
+ {
+
connection.sendMessage(text.toString());
+ }
text = null;
}
else if (binary != null)
{
byte[] bytes = binary.toByteArray();
- connection.sendMessage(bytes, 0,
bytes.length);
+ if (asynchronous)
+ {
+ connection.sendMessageAsync(bytes, 0, bytes.length,
timeout);
Review Comment:
indentation issue
##########
wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/IWebSocketConnection.java:
##########
@@ -130,6 +130,31 @@
*/
void sendMessage(IWebSocketPushMessage message);
+ /**
+ * Broadcasts a push message to the wicket page (and it's components)
associated with this
+ * connection. The components can then send messages or component
updates to client by adding
+ * them to the target. Pushing to client is done asynchronously.
+ *
+ * @param message
+ * the push message to send
+ *
+ */
+ void sendMessageAsync(IWebSocketPushMessage message);
Review Comment:
Looking at the code it won't be easy ...
##########
wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/IWebSocketConnection.java:
##########
@@ -130,6 +130,31 @@
*/
void sendMessage(IWebSocketPushMessage message);
+ /**
+ * Broadcasts a push message to the wicket page (and it's components)
associated with this
+ * connection. The components can then send messages or component
updates to client by adding
+ * them to the target. Pushing to client is done asynchronously.
+ *
+ * @param message
+ * the push message to send
+ *
+ */
+ void sendMessageAsync(IWebSocketPushMessage message);
Review Comment:
The earlier methods return `Future<Void>`. Can we do the same here too ?
> allow to process web socket push messages in an asynchronous way.
> -----------------------------------------------------------------
>
> Key: WICKET-6969
> URL: https://issues.apache.org/jira/browse/WICKET-6969
> Project: Wicket
> Issue Type: Improvement
> Reporter: Ernesto Reinaldo Barreiro
> Priority: Major
>
> Currently web socket push messages are always processed in a synchronous
> way. Allow to configure applications to use by default asynchronous messages.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)