Fixes event type when emitting binary_ack
When submitting binary data in an Ack to the server the packet's type was not the expected (should be 6 - binary_ack - and not 3 - ack). This commit introduces tests as well a fix for the given problem.
This commit is contained in:
@@ -346,7 +346,13 @@ public class Socket extends Emitter {
|
||||
sent[0] = true;
|
||||
logger.fine(String.format("sending ack %s", args.length != 0 ? args : null));
|
||||
|
||||
int type = HasBinary.hasBinary(args) ? Parser.BINARY_ACK : Parser.ACK;
|
||||
JSONArray jsonArgs = new JSONArray();
|
||||
for (Object arg : args) {
|
||||
jsonArgs.put(arg);
|
||||
}
|
||||
|
||||
int type = HasBinary.hasBinary(jsonArgs)
|
||||
? Parser.BINARY_ACK : Parser.ACK;
|
||||
Packet<JSONArray> packet = new Packet<JSONArray>(type, new JSONArray(Arrays.asList(args)));
|
||||
packet.id = id;
|
||||
self.packet(packet);
|
||||
|
||||
Reference in New Issue
Block a user