* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -21,12 +21,23 @@
/**
* broadcast interface
- *
*/
public interface BroadcastOperations extends ClientOperations {
Collection getClients();
+ /**
+ * {@link Packet#attachments} needs to be filled when sending byte[].
+ * Using {@link io.netty.buffer.Unpooled#wrappedBuffer(byte[])} to
+ * fill byte[] into {@link Packet#attachments} is the recommended way.
+ * Before using {@link Packet#addAttachment(io.netty.buffer.ByteBuf)},
+ * be sure to initialize the number of attachments with
+ * {@link Packet#initAttachments(int)})}
+ *
+ * @param packet
+ * @param ackCallback
+ * @param
+ */
void send(Packet packet, BroadcastAckCallback ackCallback);
void sendEvent(String name, SocketIOClient excludedClient, Object... data);
diff --git a/src/main/java/com/corundumstudio/socketio/ClientOperations.java b/src/main/java/com/corundumstudio/socketio/ClientOperations.java
index dc576608..79a9bb4b 100644
--- a/src/main/java/com/corundumstudio/socketio/ClientOperations.java
+++ b/src/main/java/com/corundumstudio/socketio/ClientOperations.java
@@ -27,6 +27,13 @@ public interface ClientOperations {
* Send custom packet.
* But {@link ClientOperations#sendEvent} method
* usage is enough for most cases.
+ * If the Packet is sent by BroadcastOperations,
+ * {@link Packet#attachments} needs to be filled when sending byte[].
+ * Using {@link io.netty.buffer.Unpooled#wrappedBuffer(byte[])} to
+ * fill byte[] into {@link Packet#attachments} is the recommended way.
+ * Before using {@link Packet#addAttachment(io.netty.buffer.ByteBuf)},
+ * be sure to initialize the number of attachments with
+ * {@link Packet#initAttachments(int)})}
*
* @param packet - packet to send
*/
diff --git a/src/main/java/com/corundumstudio/socketio/SingleRoomBroadcastOperations.java b/src/main/java/com/corundumstudio/socketio/SingleRoomBroadcastOperations.java
index 8957c5df..6d5f6c17 100644
--- a/src/main/java/com/corundumstudio/socketio/SingleRoomBroadcastOperations.java
+++ b/src/main/java/com/corundumstudio/socketio/SingleRoomBroadcastOperations.java
@@ -1,12 +1,12 @@
/**
* Copyright (c) 2012-2019 Nikita Koksharov
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
+ *