|
@@ -29,6 +29,7 @@ util.inherits(DataConnection, EventEmitter);
|
|
|
DataConnection.prototype._configureDataChannel = function() {
|
|
|
var self = this;
|
|
|
if (util.browserisms !== 'Webkit') {
|
|
|
+ // Webkit doesn't support binary yet
|
|
|
this._dc.binaryType = 'arraybuffer';
|
|
|
}
|
|
|
this._dc.onopen = function() {
|
|
@@ -37,7 +38,7 @@ DataConnection.prototype._configureDataChannel = function() {
|
|
|
self.emit('open');
|
|
|
};
|
|
|
|
|
|
- // Reliable.
|
|
|
+ // Use the Reliable shim for non Firefox browsers
|
|
|
if (this.reliable && util.browserisms !== 'Firefox') {
|
|
|
this._reliable = new Reliable(this._dc, util.debug);
|
|
|
}
|
|
@@ -74,6 +75,7 @@ DataConnection.prototype._handleDataMessage = function(e) {
|
|
|
var datatype = data.constructor;
|
|
|
if (this.serialization === 'binary' || this.serialization === 'binary-utf8') {
|
|
|
if (datatype === Blob) {
|
|
|
+ // Datatype should never be blob
|
|
|
util.blobToArrayBuffer(data, function(ab) {
|
|
|
data = util.unpack(ab);
|
|
|
self.emit('data', data);
|
|
@@ -82,6 +84,7 @@ DataConnection.prototype._handleDataMessage = function(e) {
|
|
|
} else if (datatype === ArrayBuffer) {
|
|
|
data = util.unpack(data);
|
|
|
} else if (datatype === String) {
|
|
|
+ // String fallback for binary data for browsers that don't support binary yet
|
|
|
var ab = util.binaryStringToArrayBuffer(data);
|
|
|
data = util.unpack(ab);
|
|
|
}
|