From 814c354003333acb4cc6a64f0cd95ac8b302ee22 Mon Sep 17 00:00:00 2001 From: Yusuke Hata Date: Wed, 25 May 2011 20:07:55 +0900 Subject: [PATCH] * android compatible: CommonJS(module/1.1) *require* method. * android HttpClient.responseText default data isNull problem(iOS responseText was ''::emptyString) ** compat: responseText defaults '' --- Resources/socket.io-titanium.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Resources/socket.io-titanium.js b/Resources/socket.io-titanium.js index dbd20bf..e66fc0e 100644 --- a/Resources/socket.io-titanium.js +++ b/Resources/socket.io-titanium.js @@ -123,8 +123,20 @@ var io = this.io; return req; }; io.Transport.XHR.request = function (){ - return Titanium.Network.createHTTPClient(); + var client = Titanium.Network.createHTTPClient(); + if(/android/i.test(Titanium.Platform.osname)){ + client.responseText = ''; + } + return client; }; })(); require('socket.io/lib/transports/xhr-polling'); + +exports = { + io: io, + Socket: io.Socket, + createSocket: function (host, options){ + return new io.Socket(host, options); + } +};