Skip to content

Commit 658b8fd

Browse files
committed
Release 1.0.4
1 parent fa60e79 commit 658b8fd

File tree

3 files changed

+25
-7
lines changed

3 files changed

+25
-7
lines changed

History.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11

2+
1.0.4 / 2014-06-02
3+
==================
4+
5+
* update build
6+
27
1.0.3 / 2014-05-31
38
==================
49

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "socket.io-client",
3-
"version": "1.0.3",
3+
"version": "1.0.4",
44
"keywords": [
55
"realtime",
66
"framework",
@@ -22,7 +22,7 @@
2222
"indexof": "0.0.1"
2323
},
2424
"devDependencies": {
25-
"socket.io": "1.0.3",
25+
"socket.io": "1.0.4",
2626
"mocha": "1.16.2",
2727
"zuul": "1.6.3",
2828
"istanbul": "0.2.1",

socket.io.js

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4378,6 +4378,10 @@ function hasBinary(data) {
43784378
}
43794379
}
43804380
} else if (obj && 'object' == typeof obj) {
4381+
if (obj.toJSON) {
4382+
obj = obj.toJSON();
4383+
}
4384+
43814385
for (var key in obj) {
43824386
if (recursiveCheckForBinary(obj[key])) {
43834387
return true;
@@ -4589,7 +4593,7 @@ exports.deconstructPacket = function(packet) {
45894593
newData[i] = deconstructBinPackRecursive(data[i]);
45904594
}
45914595
return newData;
4592-
} else if ('object' == typeof data) {
4596+
} else if ('object' == typeof data && !(data instanceof Date)) {
45934597
var newData = {};
45944598
for (var key in data) {
45954599
newData[key] = deconstructBinPackRecursive(data[key]);
@@ -4740,6 +4744,7 @@ exports.types = [
47404744
'EVENT',
47414745
'BINARY_EVENT',
47424746
'ACK',
4747+
'BINARY_ACK',
47434748
'ERROR'
47444749
];
47454750

@@ -4791,6 +4796,14 @@ exports.ERROR = 4;
47914796

47924797
exports.BINARY_EVENT = 5;
47934798

4799+
/**
4800+
* Packet type `binary ack`. For acks with binary arguments.
4801+
*
4802+
* @api public
4803+
*/
4804+
4805+
exports.BINARY_ACK = 6;
4806+
47944807
exports.Encoder = Encoder
47954808

47964809
/**
@@ -4813,7 +4826,7 @@ function Encoder() {};
48134826
Encoder.prototype.encode = function(obj, callback){
48144827
debug('encoding packet %j', obj);
48154828

4816-
if (exports.BINARY_EVENT == obj.type || exports.ACK == obj.type) {
4829+
if (exports.BINARY_EVENT == obj.type || exports.BINARY_ACK == obj.type) {
48174830
encodeAsBinary(obj, callback);
48184831
}
48194832
else {
@@ -4838,7 +4851,7 @@ function encodeAsString(obj) {
48384851
str += obj.type;
48394852

48404853
// attachments if we have them
4841-
if (exports.BINARY_EVENT == obj.type || exports.ACK == obj.type) {
4854+
if (exports.BINARY_EVENT == obj.type || exports.BINARY_ACK == obj.type) {
48424855
str += obj.attachments;
48434856
str += '-';
48444857
}
@@ -4924,7 +4937,7 @@ Decoder.prototype.add = function(obj) {
49244937
var packet;
49254938
if ('string' == typeof obj) {
49264939
packet = decodeString(obj);
4927-
if (exports.BINARY_EVENT == packet.type || exports.ACK == packet.type) { // binary packet's json
4940+
if (exports.BINARY_EVENT == packet.type || exports.BINARY_ACK == packet.type) { // binary packet's json
49284941
this.reconstructor = new BinaryReconstructor(packet);
49294942

49304943
// no attachments, labeled binary but no binary data to follow
@@ -4970,7 +4983,7 @@ function decodeString(str) {
49704983
if (null == exports.types[p.type]) return error();
49714984

49724985
// look up attachments if type binary
4973-
if (exports.BINARY_EVENT == p.type || exports.ACK == p.type) {
4986+
if (exports.BINARY_EVENT == p.type || exports.BINARY_ACK == p.type) {
49744987
p.attachments = '';
49754988
while (str.charAt(++i) != '-') {
49764989
p.attachments += str.charAt(i);

0 commit comments

Comments
 (0)