@@ -29,6 +29,7 @@ exports.types = [
29
29
'EVENT' ,
30
30
'BINARY_EVENT' ,
31
31
'ACK' ,
32
+ 'BINARY_ACK' ,
32
33
'ERROR'
33
34
] ;
34
35
@@ -80,6 +81,14 @@ exports.ERROR = 4;
80
81
81
82
exports . BINARY_EVENT = 5 ;
82
83
84
+ /**
85
+ * Packet type `binary ack`. For acks with binary arguments.
86
+ *
87
+ * @api public
88
+ */
89
+
90
+ exports . BINARY_ACK = 6 ;
91
+
83
92
exports . Encoder = Encoder
84
93
85
94
/**
@@ -102,7 +111,7 @@ function Encoder() {};
102
111
Encoder . prototype . encode = function ( obj , callback ) {
103
112
debug ( 'encoding packet %j' , obj ) ;
104
113
105
- if ( exports . BINARY_EVENT == obj . type || exports . ACK == obj . type ) {
114
+ if ( exports . BINARY_EVENT == obj . type || exports . BINARY_ACK == obj . type ) {
106
115
encodeAsBinary ( obj , callback ) ;
107
116
}
108
117
else {
@@ -127,7 +136,7 @@ function encodeAsString(obj) {
127
136
str += obj . type ;
128
137
129
138
// attachments if we have them
130
- if ( exports . BINARY_EVENT == obj . type || exports . ACK == obj . type ) {
139
+ if ( exports . BINARY_EVENT == obj . type || exports . BINARY_ACK == obj . type ) {
131
140
str += obj . attachments ;
132
141
str += '-' ;
133
142
}
@@ -213,7 +222,7 @@ Decoder.prototype.add = function(obj) {
213
222
var packet ;
214
223
if ( 'string' == typeof obj ) {
215
224
packet = decodeString ( obj ) ;
216
- if ( exports . BINARY_EVENT == packet . type || exports . ACK == packet . type ) { // binary packet's json
225
+ if ( exports . BINARY_EVENT == packet . type || exports . BINARY_ACK == packet . type ) { // binary packet's json
217
226
this . reconstructor = new BinaryReconstructor ( packet ) ;
218
227
219
228
// no attachments, labeled binary but no binary data to follow
@@ -259,7 +268,7 @@ function decodeString(str) {
259
268
if ( null == exports . types [ p . type ] ) return error ( ) ;
260
269
261
270
// look up attachments if type binary
262
- if ( exports . BINARY_EVENT == p . type || exports . ACK == p . type ) {
271
+ if ( exports . BINARY_EVENT == p . type || exports . BINARY_ACK == p . type ) {
263
272
p . attachments = '' ;
264
273
while ( str . charAt ( ++ i ) != '-' ) {
265
274
p . attachments += str . charAt ( i ) ;
0 commit comments