From fa2453b4b4dedd3a2c036d09fc22a809603357cf Mon Sep 17 00:00:00 2001 From: Mark Vayngrib Date: Sat, 16 May 2015 13:06:21 -0400 Subject: [PATCH] return binary buffer --- UdpSocket.ios.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/UdpSocket.ios.js b/UdpSocket.ios.js index 819b8ea..a262299 100644 --- a/UdpSocket.ios.js +++ b/UdpSocket.ios.js @@ -43,11 +43,10 @@ function UdpSocket(type) { UdpSocket.prototype._debug = function() { // for now var args = [].slice.call(arguments) - args.unshift(this._id) - console.log.apply(console, args) + args.unshift('socket-' + this._id) + console.log.apply(null, args) } - UdpSocket.prototype.bind = function(port, address, callback) { var self = this @@ -97,6 +96,7 @@ UdpSocket.prototype.close = function() { UdpSocket.prototype._onReceive = function(info) { this._debug('received', info) + // from base64 string var buf = base64.toByteArray(info.data) var rinfo = { address: info.address, @@ -105,7 +105,7 @@ UdpSocket.prototype._onReceive = function(info) { size: buf.length } - if (typeof Buffer !== 'undefined') buf = new Buffer(buf) + if (typeof Buffer !== 'undefined') buf = new Buffer(buf, 'binary') this.emit('message', buf, rinfo) }