Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
jumperchen committed Feb 2, 2018
1 parent 9abdc0d commit df68a84
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/src/engine/parser/parser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,15 @@ class PacketParser {
return { 'type': type, 'data': data};
}

static hasBinary(List packets) {
return packets.any((map) {
final data = map['data'];
return data is ByteBuffer;
});
}
static encodePayload(List packets,
{bool supportsBinary = false, callback(_)}) {
if (supportsBinary) {
if (supportsBinary && hasBinary(packets)) {
return encodePayloadAsBinary(packets, callback);
}

Expand Down

0 comments on commit df68a84

Please sign in to comment.