You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by GitBox <gi...@apache.org> on 2022/04/01 19:32:32 UTC

[GitHub] [wicket] martin-g commented on a change in pull request #506: [WICKET-6967] allow sending asynchronous messages

martin-g commented on a change in pull request #506:
URL: https://github.com/apache/wicket/pull/506#discussion_r840866554



##########
File path: wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/IWebSocketConnection.java
##########
@@ -55,6 +56,27 @@
 	 */
 	IWebSocketConnection sendMessage(String message) throws IOException;
 
+    /**
+     * Sends a text message to the client.

Review comment:
       Please add an explanation why/how this method is different than `#sendMessage()`

##########
File path: wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/util/tester/TestWebSocketConnection.java
##########
@@ -62,15 +63,44 @@ public IWebSocketConnection sendMessage(String message) throws IOException
 		return this;
 	}
 
-	@Override
+    @Override
+    public Future<Void> sendAsynchronousMessage(String message)
+    {
+        checkOpenness();
+        onOutMessage(message);
+        return null;

Review comment:
       Just delegate to `sendAsynchronousMessage(String message, long timeOut)` with a dummy value for `timeOut`

##########
File path: wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/IWebSocketConnection.java
##########
@@ -55,6 +56,27 @@
 	 */
 	IWebSocketConnection sendMessage(String message) throws IOException;
 
+    /**
+     * Sends a text message to the client.
+     *
+     * @param message
+     *      the text message
+     * @return a {@link java.util.concurrent.Future} representing the send operation
+     *
+     */
+    Future<Void> sendAsynchronousMessage(String message);

Review comment:
       My personal preference for the name would be for `sendMessageAsync()`

##########
File path: wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/util/tester/TestWebSocketConnection.java
##########
@@ -62,15 +63,44 @@ public IWebSocketConnection sendMessage(String message) throws IOException
 		return this;
 	}
 
-	@Override
+    @Override
+    public Future<Void> sendAsynchronousMessage(String message)
+    {
+        checkOpenness();
+        onOutMessage(message);
+        return null;
+    }
+
+    @Override
+    public Future<Void> sendAsynchronousMessage(String message, long timeOut) {
+        checkOpenness();
+        onOutMessage(message);
+        return null;
+    }
+
+    @Override
 	public IWebSocketConnection sendMessage(byte[] message, int offset, int length) throws IOException
 	{
 		checkOpenness();
 		onOutMessage(message, offset, length);
 		return this;
 	}
 
-	/**
+    @Override
+    public Future<Void> sendAsynchronousMessage(byte[] message, int offset, int length) {
+        checkOpenness();
+        onOutMessage(message, offset, length);

Review comment:
       Same here




-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@wicket.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org